docs: protected String getRepositoryIdByUniqueName(String uniqueName) throws WIMException {
          boolean isDn = UniqueNameHelper.isDN(uniqueName) != null;
          if (isDn)
              uniqueName = UniqueNameHelper.getValidUniqueName(uniqueName).trim();
  
          String repo = null;
          int repoMatch = -1;
          int bestMatch = -1;
  
          for (Map.Entry<String, RepositoryWrapper> entry : repositories.entrySet()) {
              repoMatch = entry.getValue().isUniqueNameForRepository(uniqueName, isDn);
              if (repoMatch == Integer.MAX_VALUE) {
                  return entry.getKey();
              } else if (repoMatch > bestMatch) {
                  repo = entry.getKey();
                  bestMatch = repoMatch;
              }
          }
          if (repo != null) {
              return repo;
          }
  
          AuditManager auditManager = new AuditManager();
          Audit.audit(Audit.EventID.SECURITY_MEMBER_MGMT_01, auditManager.getRESTRequest(), auditManager.getRequestType(), auditManager.getRepositoryId(), uniqueName,
                      vmmService.getConfigManager().getDefaultRealmName(), null, Integer.valueOf("204"));
  
          throw new InvalidUniqueNameException(WIMMessageKey.ENTITY_NOT_IN_REALM_SCOPE, Tr.formatMessage(
                                                                                                         tc,
                                                                                                         WIMMessageKey.ENTITY_NOT_IN_REALM_SCOPE,
                                                                                                         WIMMessageHelper.generateMsgParms(uniqueName, "defined")));
      }