class DatabaseConsistencyCheckHelper {

  static Map<Long, ConfigGroup> collectConfigGroupsWithoutServiceName() {
    Map<Long, ConfigGroup> configGroupMap = new HashMap<>();
    Clusters clusters = injector.getInstance(Clusters.class);
    Map<String, Cluster> clusterMap = clusters.getClusters();

    if (MapUtils.isEmpty(clusterMap))
      return configGroupMap;

    for (Cluster cluster : clusterMap.values()) {
      Map<Long, ConfigGroup> configGroups = cluster.getConfigGroups();

      if (MapUtils.isEmpty(configGroups)) {
        continue;
      }

      for (ConfigGroup configGroup : configGroups.values()) {
        if (StringUtils.isEmpty(configGroup.getServiceName())) {
          configGroupMap.put(configGroup.getId(), configGroup);
        }
      }
    }

    return configGroupMap;
  }

}