code: private void clean(ArtifactoryCollector collector, List<ArtifactoryRepo> existingRepos) {
          // find the server url's to collect from
          Set<String> serversToBeCollected = new HashSet<>();
          serversToBeCollected.addAll(collector.getArtifactoryServers());
  
          // find the repos to collect from each server url above
          List<Set<String>> repoNamesToBeCollected = new ArrayList<Set<String>>();
          List<String[]> allRepos = new ArrayList<>();
          artifactorySettings.getServers().forEach(serverSetting -> {
              allRepos.add((String[]) getRepoAndPatternsForServ(serverSetting.getRepoAndPatterns()).keySet().toArray());
          });
          for (int i = 0; i < allRepos.size(); i++) {
              Set<String> reposSet = new HashSet<>();
              if (allRepos.get(i) != null) {
                  reposSet.addAll(Arrays.asList(allRepos.get(i)));
              }
              repoNamesToBeCollected.add(reposSet);
          }
  
          assert (serversToBeCollected.size() == repoNamesToBeCollected.size());
  
          List<ArtifactoryRepo> stateChangeRepoList = new ArrayList<>();
          for (ArtifactoryRepo repo : existingRepos) {
              if (isRepoEnabledAndNotCollected(collector, serversToBeCollected, repoNamesToBeCollected, repo) ||  // if it was enabled but not to be collected
                      isRepoDisabledAndToBeCollected(collector, serversToBeCollected, repoNamesToBeCollected, repo)) { // OR it was disabled and now is to be collected
                  repo.setEnabled(isRepoCollected(collector, serversToBeCollected, repoNamesToBeCollected, repo));
                  stateChangeRepoList.add(repo);
              }
          }
          if (!CollectionUtils.isEmpty(stateChangeRepoList)) {
              artifactoryRepoRepository.save(stateChangeRepoList);
          }
      }
docs: Clean up unused artifactory collector items
  
  @param collector the {@link ArtifactoryCollector}