protected function formatGroupItemField(GroupItemField $field, ItemInterface $item)
    {
        $name = $field->getName();
        $element = $this->dom->createElement($name);

        $this->addAttributes($element, $field, $item);

        $itemFields = $field->getItemFields();

        foreach ($itemFields as $itemField) {
            $class = get_class($itemField);

            switch ($class) {
                case GroupItemField::class:
                    $itemElements = $this->formatGroupItemField($itemField, $item);
                    break;

                case MediaItemField::class:
                    $itemElements = $this->formatMediaItemField($itemField, $item);
                    break;

                case ItemField::class:
                    $itemElements = $this->formatItemField($itemField, $item);
                    break;
            }

            foreach ($itemElements as $itemElement) {
                $element->appendChild($itemElement);
            }
        }

        return [$element];
    }