/**
   * @param group
   * @throws org.apache.directory.fortress.core.CreateException
   */
  Group create(Group group) throws CreateException {
    LdapConnection ld = null;
    String nodeDn = getDn(group.getName(), group.getContextId());

    try {
      LOG.debug("create group dn [{}]", nodeDn);
      Entry myEntry = new DefaultEntry(nodeDn);
      myEntry.add(SchemaConstants.OBJECT_CLASS_AT, GROUP_OBJ_CLASS);
      myEntry.add(SchemaConstants.CN_AT, group.getName());
      // protocol is required:
      myEntry.add(GROUP_PROTOCOL_ATTR_IMPL, group.getProtocol());
      // type is required:
      myEntry.add(GlobalIds.TYPE, group.getType().toString());

      loadAttrs(group.getMembers(), myEntry, SchemaConstants.MEMBER_AT);
      loadProperties(group.getProperties(), myEntry, GROUP_PROPERTY_ATTR_IMPL, '=');

      if (StringUtils.isNotEmpty(group.getDescription())) {
        myEntry.add(SchemaConstants.DESCRIPTION_AT, group.getDescription());
      }

      ld = getAdminConnection();
      add(ld, myEntry);
    } catch (LdapException e) {
      String error = "create group node dn [" + nodeDn + "] caught LDAPException=" + e.getMessage();
      throw new CreateException(GlobalErrIds.GROUP_ADD_FAILED, error, e);
    } finally {
      closeAdminConnection(ld);
    }

    return group;
  }
  private void recordUnidentifiableModifiedResidues(List<ModifiedCompound> modComps) {
    Set<StructureGroup> identifiedComps = new HashSet<StructureGroup>();
    for (ModifiedCompound mc : modComps) {
      identifiedComps.addAll(mc.getGroups(true));
    }

    // TODO: use the ModifiedAminoAcid after Andreas add that.
    for (Group group : residues) {
      if (group.getType().equals(GroupType.HETATM)) {
        StructureGroup strucGroup = StructureUtil.getStructureGroup(group, true);
        if (!identifiedComps.contains(strucGroup)) {
          unidentifiableModifiedResidues.add(strucGroup);
        }
      }
    }
  }