docs: private List<RepositoryResource> findResourcesToHide(RepositoryResourceImpl newResource,
                                                           List<RepositoryResourceImpl> matchingResources) throws RepositoryBackendException, RepositoryResourceException {
  
          // build a list of matching ids
          List<String> matchingResourceIds = new ArrayList<String>();
          for (RepositoryResourceImpl r : matchingResources) {
              matchingResourceIds.add(r.getId());
          }
  
          String vanityURL = newResource.getVanityURL();
          RepositoryConnection repo = newResource.getRepositoryConnection();
          Collection<RepositoryResource> resourcesWithSameVanityURLs = repo.getMatchingResources(FilterPredicate.areEqual(FilterableAttribute.VANITY_URL, vanityURL));
  
          List<RepositoryResource> resourcesToHide = new ArrayList<RepositoryResource>();
          RepositoryResource newestResource = newResource;
  
          // create list which excludes hidden and unpublished resources.  Also exclude matching resources as they will
          // be deleted so will not have to be hidden
          for (RepositoryResource resource : resourcesWithSameVanityURLs) {
  
              if (!isVisibleAndWebDisplayable(resource)) {
                  continue;
              }
              if (!State.PUBLISHED.equals(((RepositoryResourceWritable) resource).getState())) {
                  continue;
              }
              if (matchingResourceIds.contains(resource.getId())) {
                  continue;
              }
  
              // newestResource is passed to method as parameter #1 as this the default return value
              // if there is no appliesTo / ProductVersion ie if we can't find which is the newer version we
              // default to leaving the most recently added visible.
              newestResource = getNewerResource(newestResource, resource);
              resourcesToHide.add(resource);
          }
  
          // remove the highest matching asset from the list so it won't get hidden
          // should only be one matching non-hidden resource.
          resourcesToHide.remove(newestResource);
  
          // add the newResource to the list if it wasn't the highest (ie eligible for hiding)
          if (newestResource != newResource) {
              resourcesToHide.add(newResource);
          }
  
          return resourcesToHide;
      }