private function getVisibleModel(
        Action $action,
        ModelInterface $editModel,
        DataProviderInterface $dataProvider,
        EnvironmentInterface $environment
    ) {
        $selectProperties = (array) $this->getPropertiesFromSession($action, $environment);

        $visibleModel = $dataProvider->getEmptyModel();
        $visibleModel->setId($editModel->getId());

        $widgetManager    = new ContaoWidgetManager($environment, $editModel);
        $propertyValueBag = new PropertyValueBag();

        foreach (\array_keys($selectProperties) as $visiblePropertyName) {
            $visiblePropertyValue = $editModel->getProperty($visiblePropertyName);

            $propertyValueBag->setPropertyValue($visiblePropertyName, $visiblePropertyValue);

            $visibleModel->setProperty(
                $visiblePropertyName,
                $widgetManager->encodeValue(
                    $visiblePropertyName,
                    $widgetManager->decodeValue($visiblePropertyName, $visiblePropertyValue),
                    $propertyValueBag
                )
            );
        }

        return $visibleModel;
    }