@VisibleForTesting
  @NotNull
  static RepositoryDiff<List<MavenIndex>> getRemoteDiff(
    @NotNull Map<String, Set<String>> remoteRepositoryIdsByUrl,
    @NotNull List<MavenIndex> currentRemoteIndex,
    @NotNull RepositoryDiffContext context) {
    Map<String, MavenIndex> currentRemoteIndicesByUrls = currentRemoteIndex.stream()
      .collect(Collectors.toMap(i -> i.getRepository().getUrl(), Function.identity()));
    if (currentRemoteIndicesByUrls.keySet().equals(remoteRepositoryIdsByUrl.keySet())) {
      return new RepositoryDiff<>(currentRemoteIndex, Collections.emptyList());
    }

    List<MavenIndex> oldIndices = ContainerUtil
      .filter(currentRemoteIndex, i -> !remoteRepositoryIdsByUrl.containsKey(i.getRepository().getUrl()));

    List<MavenIndex> newMavenIndices = ContainerUtil.map(remoteRepositoryIdsByUrl
                                                           .entrySet(), e -> {
      MavenIndex oldIndex = currentRemoteIndicesByUrls.get(e.getKey());
      if (oldIndex != null) return oldIndex;
      String id = e.getValue().iterator().next();
      return createMavenIndex(id, e.getKey(), RepositoryKind.REMOTE);
    });

    return new RepositoryDiff<>(newMavenIndices, oldIndices);
  }
@VisibleForTesting
  @NotNull
  static RepositoryDiff<List<MavenIndex>> getRemoteDiff(
    @NotNull Map<String, Set<String>> remoteRepositoryIdsByUrl,
    @NotNull List<MavenIndex> currentRemoteIndex,
    @NotNull RepositoryDiffContext context)