protected function deepDelete(EnvironmentInterface $environment, ModelIdInterface $modelId)
    {
        /** @var DefaultModelRelationshipDefinition $relationships */
        $relationships = $environment->getDataDefinition()->getDefinition('model-relationships');

        $childConditions = $relationships->getChildConditions($modelId->getDataProviderName());

        // delete child element before delete parent element
        /** @var ParentChildConditionInterface $childCondition */
        foreach ($childConditions as $childCondition) {
            $destinationChildConditions = $relationships->getChildConditions($childCondition->getDestinationName());
            if (empty($destinationChildConditions)) {
                continue;
            }

            $dataProvider                 = $environment->getDataProvider($modelId->getDataProviderName());
            $model                        = $dataProvider->fetch(
                $dataProvider->getEmptyConfig()->setId($modelId->getId())
            );
            $destinationChildDataProvider = $environment->getDataProvider($childCondition->getDestinationName());

            /** @var DefaultCollection $destinationChildModels */
            $destinationChildModels = $destinationChildDataProvider->fetchAll(
                $dataProvider->getEmptyConfig()->setFilter($childCondition->getFilter($model))
            );
            if ($destinationChildModels->count() < 1) {
                continue;
            }

            foreach ($destinationChildModels as $destinationChildModel) {
                $this->deepDelete($environment, ModelId::fromModel($destinationChildModel));
            }
        }

        foreach ($childConditions as $childCondition) {
            $dataProvider      = $environment->getDataProvider($modelId->getDataProviderName());
            $model             = $dataProvider->fetch($dataProvider->getEmptyConfig()->setId($modelId->getId()));
            $childDataProvider = $environment->getDataProvider($childCondition->getDestinationName());

            $filters = $childCondition->getFilter($model);
            /** @var DefaultCollection $childModels */
            $childModels = $childDataProvider->fetchAll($dataProvider->getEmptyConfig()->setFilter($filters));
            if ($childModels->count() < 1) {
                continue;
            }

            foreach ($childModels as $childModel) {
                // Trigger event before the model will be deleted.
                $preDeleteEvent = new PreDeleteModelEvent($environment, $childModel);
                $environment->getEventDispatcher()->dispatch($preDeleteEvent::NAME, $preDeleteEvent);

                $childDataProvider->delete($childModel);

                // Trigger event after the model is deleted.
                $postDeleteEvent = new PostDeleteModelEvent($environment, $childModel);
                $environment->getEventDispatcher()->dispatch($postDeleteEvent::NAME, $postDeleteEvent);
            }
        }
    }