/**
   * Handles the creation of group properties, group properties are properties that are linked together in some manner.
   * Group properties are constructed using the {@code createPropertyBox) method found below.
   *
   * @param artifact
   * @param propertyName
   * @param propertyType
   * @param empty
   * @param container
   * @return  the VBox
   */
  private VBox createGroupPropertySection(
      PackageArtifact artifact,
      String propertyName,
      String propertyType,
      boolean empty,
      PackageDescriptionViewImpl.ArtifactPropertyContainer container) {
    VBox complexPropertyBox = new VBox(8);
    Separator separator = new Separator();
    complexPropertyBox.getChildren().add(separator);

    // If the artifact has the property and we're not adding an empty field add the sub property
    // values
    if (artifact.getPropertyNames().contains(propertyName) && !empty) {
      for (PackageArtifact.PropertyValueGroup group :
          artifact.getPropertyValueGroups(propertyName)) {
        Map<String, Set<StringProperty>> subPropertyFields = new HashMap<>();

        Label propertyNameLabel = new Label(ontologyLabels.get(propertyName));
        propertyNameLabel.setPrefWidth(100);
        propertyNameLabel.setWrapText(true);
        complexPropertyBox.getChildren().add(propertyNameLabel);

        List<String> sortedProperties = new ArrayList<>();

        // Get the creator property set and then create a sorted list from it.
        sortedProperties.addAll(packageOntologyService.getGroupPropertyNames(propertyType));
        sortProperties(sortedProperties, artifact, propertyType);

        for (String fieldName : sortedProperties) {
          Set<String> values = group.getSubPropertyValues(fieldName);
          int maxOccurs =
              packageOntologyService.getPropertyMaxOccurrences(artifact, fieldName, propertyType);
          int minOccurs =
              packageOntologyService.getPropertyMinOccurrences(artifact, fieldName, propertyType);
          boolean systemGenerated =
              packageOntologyService.isSystemSuppliedProperty(artifact, fieldName);
          Set<StringProperty> fields = new HashSet<>();
          complexPropertyBox
              .getChildren()
              .add(
                  new TextPropertyBox(
                      artifact,
                      propertyName,
                      ontologyLabels.get(fieldName),
                      fieldName,
                      values,
                      maxOccurs,
                      fields,
                      minOccurs,
                      systemGenerated,
                      packageOntologyService,
                      labels,
                      messages,
                      applyButtonValidationListener));
          subPropertyFields.put(fieldName, fields);
        }
        container.subProperties.add(subPropertyFields);
      }
      // Otherwise just add the empty text fields for the possible property values.
    } else {
      Map<String, Set<StringProperty>> subPropertyFields = new HashMap<>();

      Label propertyNameLabel = new Label(ontologyLabels.get(propertyName));
      propertyNameLabel.setPrefWidth(100);
      propertyNameLabel.setWrapText(true);
      complexPropertyBox.getChildren().add(propertyNameLabel);

      List<String> sortedProperties = new ArrayList<>();

      // Get the creator property set and then create a sorted list from it.
      sortedProperties.addAll(packageOntologyService.getGroupPropertyNames(propertyType));
      sortProperties(sortedProperties, artifact, propertyType);

      // For each field create a property box
      for (String fieldName : sortedProperties) {
        // String fieldType = packageOntologyService.getComplexPropertySubPropertyType(propertyType,
        // fieldName);
        int maxOccurs =
            packageOntologyService.getPropertyMaxOccurrences(artifact, fieldName, propertyType);
        int minOccurs =
            packageOntologyService.getPropertyMinOccurrences(artifact, fieldName, propertyType);
        boolean systemGenerated =
            packageOntologyService.isSystemSuppliedProperty(artifact, fieldName);
        Set<StringProperty> fields = new HashSet<>();
        complexPropertyBox
            .getChildren()
            .add(
                new TextPropertyBox(
                    artifact,
                    propertyName,
                    ontologyLabels.get(fieldName),
                    fieldName,
                    null,
                    maxOccurs,
                    fields,
                    minOccurs,
                    systemGenerated,
                    packageOntologyService,
                    labels,
                    messages,
                    applyButtonValidationListener));

        subPropertyFields.put(fieldName, fields);
      }

      container.subProperties.add(subPropertyFields);
    }
    return complexPropertyBox;
  }