docs: private void primUpdateMembers(EntityGroupImpl egi, Connection conn) throws SQLException {
          String groupKey = egi.getLocalKey();
          String memberKey, isGroup, serviceName = null;
          try {
              if (egi.hasDeletes()) {
                  List deletedGroups = new ArrayList();
                  List deletedEntities = new ArrayList();
                  Iterator deletes = egi.getRemovedMembers().values().iterator();
                  while (deletes.hasNext()) {
                      IGroupMember gm = (IGroupMember) deletes.next();
                      if (gm.isGroup()) {
                          deletedGroups.add(gm);
                      } else {
                          deletedEntities.add(gm);
                      }
                  }
  
                  if (!deletedGroups.isEmpty()) {
                      PreparedStatement psDeleteMemberGroup =
                              conn.prepareStatement(getDeleteMemberGroupSql());
  
                      try {
                          for (Iterator groups = deletedGroups.iterator(); groups.hasNext(); ) {
                              IEntityGroup removedGroup = (IEntityGroup) groups.next();
                              memberKey = removedGroup.getLocalKey();
                              isGroup = MEMBER_IS_GROUP;
                              serviceName = removedGroup.getServiceName().toString();
  
                              psDeleteMemberGroup.setString(1, groupKey);
                              psDeleteMemberGroup.setString(2, serviceName);
                              psDeleteMemberGroup.setString(3, memberKey);
  
                              if (LOG.isDebugEnabled())
                                  LOG.debug(
                                          "RDBMEntityGroupStore.primUpdateMembers(): "
                                                  + psDeleteMemberGroup
                                                  + "("
                                                  + groupKey
                                                  + ", "
                                                  + serviceName
                                                  + ", "
                                                  + memberKey
                                                  + ", isGroup = T)");
  
                              psDeleteMemberGroup.executeUpdate();
                          } // for
                      } // try
                      finally {
                          psDeleteMemberGroup.close();
                      }
                  } // if ( ! deletedGroups.isEmpty() )
  
                  if (!deletedEntities.isEmpty()) {
                      PreparedStatement psDeleteMemberEntity =
                              conn.prepareStatement(getDeleteMemberEntitySql());
  
                      try {
                          for (Iterator entities = deletedEntities.iterator(); entities.hasNext(); ) {
                              IGroupMember removedEntity = (IGroupMember) entities.next();
                              memberKey = removedEntity.getUnderlyingEntityIdentifier().getKey();
                              isGroup = MEMBER_IS_ENTITY;
  
                              psDeleteMemberEntity.setString(1, groupKey);
                              psDeleteMemberEntity.setString(2, memberKey);
  
                              if (LOG.isDebugEnabled())
                                  LOG.debug(
                                          "RDBMEntityGroupStore.primUpdateMembers(): "
                                                  + psDeleteMemberEntity
                                                  + "("
                                                  + groupKey
                                                  + ", "
                                                  + memberKey
                                                  + ", "
                                                  + "isGroup = F)");
  
                              psDeleteMemberEntity.executeUpdate();
                          } // for
                      } // try
                      finally {
                          psDeleteMemberEntity.close();
                      }
                  } //  if ( ! deletedEntities.isEmpty() )
              }
  
              if (egi.hasAdds()) {
                  PreparedStatement psAdd = conn.prepareStatement(getInsertMemberSql());
  
                  try {
                      Iterator adds = egi.getAddedMembers().values().iterator();
                      while (adds.hasNext()) {
                          IGroupMember addedGM = (IGroupMember) adds.next();
                          memberKey = addedGM.getKey();
                          if (addedGM.isGroup()) {
                              IEntityGroup addedGroup = (IEntityGroup) addedGM;
                              isGroup = MEMBER_IS_GROUP;
                              serviceName = addedGroup.getServiceName().toString();
                              memberKey = addedGroup.getLocalKey();
                          } else {
                              isGroup = MEMBER_IS_ENTITY;
                              serviceName = egi.getServiceName().toString();
                              memberKey = addedGM.getUnderlyingEntityIdentifier().getKey();
                          }
  
                          psAdd.setString(1, groupKey);
                          psAdd.setString(2, serviceName);
                          psAdd.setString(3, memberKey);
                          psAdd.setString(4, isGroup);
  
                          if (LOG.isDebugEnabled())
                              LOG.debug(
                                      "RDBMEntityGroupStore.primUpdateMembers(): "
                                              + psAdd
                                              + "("
                                              + groupKey
                                              + ", "
                                              + memberKey
                                              + ", "
                                              + isGroup
                                              + ")");
  
                          psAdd.executeUpdate();
                      }
                  } finally {
                      psAdd.close();
                  }
              }
  
          } catch (SQLException sqle) {
              LOG.error("Error inserting/deleting membership rows.", sqle);
              throw sqle;
          }
      }