private function getModelId(EnvironmentInterface $environment)
    {
        $inputProvider = $environment->getInputProvider();

        if ($inputProvider->hasParameter('id') && $inputProvider->getParameter('id')) {
            $modelId = ModelId::fromSerialized($inputProvider->getParameter('id'));
        }

        if (!(isset($modelId)
              && ($environment->getDataDefinition()->getName() === $modelId->getDataProviderName()))
        ) {
            return null;
        }

        return $modelId;
    }