private function renderEditFields(
        Action $action,
        ContaoWidgetManager $widgetManager,
        ModelInterface $model,
        PropertyValueBagInterface $propertyValuesBag,
        EnvironmentInterface $environment
    ) {
        $properties = $environment->getDataDefinition()->getPropertiesDefinition();

        $selectProperties = (array) $this->getPropertiesFromSession($action, $environment);

        $modelId      = ModelId::fromModel($model);
        $dataProvider = $environment->getDataProvider($modelId->getDataProviderName());
        $editModel    = $dataProvider->fetch($dataProvider->getEmptyConfig()->setId($modelId->getId()));
        $visibleModel = $this->getVisibleModel($action, $editModel, $dataProvider, $environment);

        $fields = [];
        foreach ($selectProperties as $selectProperty) {
            if (!$this->ensurePropertyVisibleInModel(
                $action,
                $selectProperty->getName(),
                $visibleModel,
                $environment
            )) {
                $fields[] =
                    $this->injectSelectParentPropertyInformation($action, $selectProperty, $editModel, $environment);

                continue;
            }

            $editProperty = $this->buildEditProperty($selectProperty, $modelId);

            $properties->addProperty($editProperty);

            $this->setPropertyValue($editModel, $selectProperty, $propertyValuesBag);
            $this->markEditErrors($editProperty, $selectProperty, $propertyValuesBag);
            $this->markModelErrors(
                $action,
                $model,
                $model,
                $editProperty,
                $selectProperty,
                $propertyValuesBag,
                $environment
            );

            $fields[] = $widgetManager->renderWidget($editProperty->getName(), false, $propertyValuesBag);
            $fields[] = $this->injectSelectSubPropertiesInformation(
                $selectProperty,
                $editModel,
                $propertyValuesBag,
                $environment
            );
        }

        if (null === $fields[0]) {
            $fields[] = \sprintf(
                '<p>&nbsp;</p><strong>%s</strong><p>&nbsp;</p>',
                $environment->getTranslator()->translate('MSC.no_properties_available')
            );
        }

        return $fields;
    }