docs: @Override
      public Root get(Root root) throws WIMException {
          Root returnRoot = new Root();
          String uniqueName = null;
          String auditName = null;
          AuditManager auditManager = new AuditManager();
  
          try {
              List<String> attrList = null;
              List<String> grpMbrAttrs = null;
              List<String> grpMbrshipAttrs = null;
  
              // Retrieve control objects
              Map<String, Control> ctrlMap = ControlsHelper.getControlMap(root);
              PropertyControl propertyCtrl = (PropertyControl) ctrlMap.get(Service.DO_PROPERTY_CONTROL);
              GroupMemberControl grpMbrCtrl = (GroupMemberControl) ctrlMap.get(SchemaConstants.DO_GROUP_MEMBER_CONTROL);
              GroupMembershipControl grpMbrshipCtrl = (GroupMembershipControl) ctrlMap.get(SchemaConstants.DO_GROUP_MEMBERSHIP_CONTROL);
  
              // Set attributes to retrieve for member and membership operations.
              if (grpMbrCtrl != null) {
                  grpMbrAttrs = getAttributes(grpMbrCtrl, personAccountType);
              }
              if (grpMbrshipCtrl != null) {
                  grpMbrshipAttrs = getAttributes(grpMbrshipCtrl, groupAccountType);
              }
  
              // Get a list of all the entities.
              List<Entity> entities = root.getEntities();
              for (Entity entity : entities) {
                  uniqueName = entity.getIdentifier().getUniqueName();
                  if (uniqueName == null) { // find a name that we can use for audit purposes
                      if (entity.getIdentifier().getUniqueId() != null) {
                          auditName = entity.getIdentifier().getUniqueId();
                      } else if (entity.getIdentifier().getExternalName() != null) {
                          auditName = entity.getIdentifier().getExternalName();
                      } else if (entity.getIdentifier().getExternalId() != null) {
                          auditName = entity.getIdentifier().getExternalId();
                      }
                  }
  
                  String memberType = validateEntity(entity);
  
                  Entity returnEntity = null;
                  if (Service.DO_GROUP.equalsIgnoreCase(memberType))
                      returnEntity = new Group();
                  else
                      returnEntity = new PersonAccount();
  
                  returnRoot.getEntities().add(returnEntity);
                  IdentifierType identifier = new IdentifierType();
                  identifier.setRepositoryId(reposId);
                  returnEntity.setIdentifier(identifier);
  
                  // Wrap the entity in an object that provides functionality to the entity.
                  URBridgeEntityFactory osEntityFactory = new URBridgeEntityFactory();
                  URBridgeEntity osEntity = osEntityFactory.createObject(returnEntity, this,
                                                                         propsMap, baseEntryName, entityConfigMap);
                  osEntity.setSecurityNameProp(uniqueName);
  
                  // Get the attributes and populate the entity.
                  attrList = getAttributes(propertyCtrl, memberType);
                  if (attrList != null) {
                      osEntity.populateEntity(attrList);
                  }
  
                  // If it's a group and there is a GroupMemberControl object, find the members.
                  if (Service.DO_GROUP.equalsIgnoreCase(memberType) && grpMbrCtrl != null && grpMbrAttrs != null) {
                      int limit = 0;
                      if (grpMbrCtrl.isSetCountLimit()) {
                          limit = grpMbrCtrl.getCountLimit();
                      }
                      osEntity.getUsersForGroup(grpMbrAttrs, limit);
                  }
  
                  // If it's a user and there is a GroupMembershipControl object, find the groups.
                  else if ((Service.DO_LOGIN_ACCOUNT.equalsIgnoreCase(memberType) || Service.DO_PERSON_ACCOUNT.equalsIgnoreCase(memberType)) &&
                           grpMbrshipCtrl != null && grpMbrshipAttrs != null) {
                      int limit = 0;
                      if (grpMbrshipCtrl.isSetCountLimit()) {
                          limit = grpMbrshipCtrl.getCountLimit();
                      }
                      osEntity.getGroupsForUser(grpMbrshipAttrs, limit);
                  }
              }
          } catch (EntityNotFoundException e) {
              Audit.audit(Audit.EventID.SECURITY_MEMBER_MGMT_01, auditManager.getRESTRequest(), AuditConstants.GET_AUDIT, reposId,
                          uniqueName == null ? auditName : uniqueName,
                          userRegistry.getRealm(),
                          returnRoot,
                          Integer.valueOf("212"), AuditConstants.URBRIDGE);
  
              throw e;
          } catch (Exception e) {
              throw new WIMException(e);
          }
  
          setReturnContext(root, returnRoot);
          auditManager.setRealm(userRegistry.getRealm());
          if (returnRoot != null && !returnRoot.getEntities().isEmpty()) {
              Audit.audit(Audit.EventID.SECURITY_MEMBER_MGMT_01, auditManager.getRESTRequest(), AuditConstants.GET_AUDIT, reposId, uniqueName, userRegistry.getRealm(),
                          returnRoot,
                          Integer.valueOf("200"), AuditConstants.URBRIDGE);
          }
          return returnRoot;
      }