public function dependentOn(array $previousFieldNames, callable $dependentStageDefineCallback, array $fieldNamesDefinedInStage = [])
    {
        if ($this->isDependent) {
            throw InvalidOperationException::format(
                'Invalid call to %s: cannot nest dependent form sections', __METHOD__
            );
        }

        $this->finishCurrentStage();

        if (!in_array(IObjectAction::OBJECT_FIELD_NAME, $previousFieldNames, true) && !$this->isCreateForm()) {
            $previousFieldNames[] = IObjectAction::OBJECT_FIELD_NAME;
        }

        $this->stages[] = new DependentFormStage(function (array $previousData) use ($dependentStageDefineCallback) {
            $this->isDependent = true;
            $objectInstance    = isset($previousData[IObjectAction::OBJECT_FIELD_NAME])
                ? $previousData[IObjectAction::OBJECT_FIELD_NAME]
                : null;

            if ($objectInstance) {
                /** @var TypedObject $objectInstance */
                $this->class                   = $objectInstance::definition();
                $this->currentEditedObjectType = get_class($objectInstance);
            }

            $dependentStageDefineCallback(
                $this,
                $previousData,
                $objectInstance
            );
            $this->isDependent = false;

            $form = $this->buildFormForCurrentStage();

            if ($objectInstance) {
                $form = $form->withInitialValuesFrom($objectInstance);
            }

            $this->exitStage();

            return $form;
        }, $fieldNamesDefinedInStage, in_array('*', $previousFieldNames, true) ? null : array_unique($previousFieldNames));
    }