private function getModelIds(EnvironmentInterface $environment, Action $action, $submitAction)
    {
        $valueKey = \in_array($submitAction, ['edit', 'override']) ? 'properties' : 'models';
        $modelIds = (array) $environment->getInputProvider()->getValue($valueKey);

        if (!empty($modelIds)) {
            $modelIds = \array_map(
                function ($modelId) {
                    return ModelId::fromSerialized($modelId);
                },
                $modelIds
            );

            $event = new PrepareMultipleModelsActionEvent($environment, $action, $modelIds, $submitAction);
            $environment->getEventDispatcher()->dispatch($event::NAME, $event);

            $modelIds = $event->getModelIds();
        }

        return $modelIds;
    }