protected function markRequiredForNestedLayoutChildren($nodes = null, $parentKey = null)
    {
        if (null === $nodes) {
            $nodes = $this->info->form->layout();
        }

        // If the data is an array walk through it and return whether any children are required
        if (is_array($nodes)) {

            $required = null;

            foreach ($nodes as $key => $value) {

                try {
                    $oneRequired = $this->markRequiredForNestedLayoutChildren($value, 'children.' . $key);

                } catch (ModelConfigurationDataException $e) {

                    throw $e->setDotKey(
                        $parentKey . ($e->getDotKey() ? '.' . $e->getDotKey() : null)
                    );
                }

                if ( ! $required && $oneRequired) {
                    $required = true;
                }
            }

            return $required;
        }

        if ($nodes instanceof ModelFormLayoutNodeInterface) {

            if ($nodes instanceof ModelFormFieldLabelData) {
                return false;
            }

            /** @var ModelFormTabData|ModelFormFieldsetData|ModelFormFieldGroupData $nodes */

            $required = $this->markRequiredForNestedLayoutChildren($nodes->children(), $parentKey);

            // Only set the required status if not explicitly set in configuration
            if (null === $nodes->required) {
                $nodes->required = $required;
            }

            return $nodes->required;
        }

        // If the node is a string, it's a field key
        if (is_string($nodes)) {

            if (array_key_exists($nodes, $this->info->form->fields)) {
                return $this->info->form->fields[ $nodes ]->required();
            }

            return false;
        }

        // @codeCoverageIgnoreStart
        return null;
        // @codeCoverageIgnoreEnd
    }