public function remove(RevisionInterface $revision)
    {
        $connection = $this->revisionRepository->getDbAdapter()->getDriver()->getConnection()->beginTransaction();
        try {
            $this->revisionRepository->remove($revision);
            if ($revision->getReleasedAt() == null) {
                $lastReleasedRevision = $revision->getEnvironment()->getLastReleasedRevision();
                $this->revisionRepository->add(clone $lastReleasedRevision);
            }
        } catch (ExceptionInterface $e) {
            $connection->rollback();
            throw $e;
        }
        $connection->commit();
        return $this;
    }