protected function getPropertyValueBagFromModel(
        Action $action,
        ModelInterface $model,
        EnvironmentInterface $environment
    ) {
        $propertiesDefinition = $environment->getDataDefinition()->getPropertiesDefinition();
        $editInformation      = $GLOBALS['container']['dc-general.edit-information'];

        $propertyValueBag = new PropertyValueBag();

        foreach ($model->getPropertiesAsArray() as $propertyName => $propertyValue) {
            if (!$propertiesDefinition->hasProperty($propertyName)) {
                continue;
            }

            $property = $propertiesDefinition->getProperty($propertyName);
            if (!$property->getWidgetType()) {
                continue;
            }

            $modelError = $editInformation->getModelError($model);
            if ($modelError && isset($modelError[$propertyName])) {
                $sessionValues = $this->getEditPropertiesByModelId($action, ModelId::fromModel($model), $environment);

                $propertyValueBag->setPropertyValue($propertyName, $sessionValues[$propertyName]);
                $propertyValueBag->markPropertyValueAsInvalid($propertyName, $modelError[$propertyName]);

                continue;
            }

            $propertyValueBag->setPropertyValue($propertyName, $propertyValue);
        }

        return $propertyValueBag;
    }