protected function revertValuesByErrors(
        Action $action,
        CollectionInterface $collection,
        EnvironmentInterface $environment
    ) {
        $editInformation = $GLOBALS['container']['dc-general.edit-information'];
        if (!$editInformation->hasAnyModelError()) {
            return;
        }

        $dataProvider = $environment->getDataProvider();
        $properties   = $this->getPropertiesFromSession($action, $environment);

        while ($collection->count() > 0) {
            $model = $collection->shift();

            $modelErrors = $editInformation->getModelError($model);
            if (!$modelErrors && ('edit' === $this->getMode($action))) {
                continue;
            }

            $revertModel = $dataProvider->fetch($dataProvider->getEmptyConfig()->setId($model->getId()));

            $originalModel = clone $revertModel;
            $revertModel->setId($revertModel->getId());

            foreach ($properties as $property) {
                if (('edit' === $this->getMode($action))
                    && !\in_array($property->getName(), $modelErrors)) {
                    continue;
                }

                $revertModel->setProperty($property->getName(), $model->getProperty($property->getName()));
            }

            $dataProvider->save($revertModel);

            $this->handlePostPersist($revertModel, $originalModel, $environment);
        }
    }