code: public void addGroupReference(final String groupName, final MetadataElement groupReference) {
          groupReference.setRef(getNamespaceValue(groupReference.getRef()));
          for (MetadataItem item : groupList) {
              if (item.getName().equals(groupName) && item.getNamespace().equals(getCurrentNamespace())) {
                  item.getReferences().add(groupReference);
                  return;
              }
          }
  
          final MetadataItem newItem = new MetadataItem(groupName);
          newItem.getReferences().add(groupReference);
          newItem.setNamespace(getCurrentNamespace());
          newItem.setSchemaName(getCurrentSchmema());
          newItem.setPackageApi(getCurrentPackageApi());
          newItem.setPackageImpl(getCurrentPackageImpl());
          groupList.add(newItem);
      }
docs: Adds a new reference to the specific group element class. If no group element class is found, then a new group
  element class. will be created.
  
  @param groupName
  the group class name of
  @param groupReference
  the new reference to be added.