protected function createLock()
	{
		$user = $this->getCurrentUser();

		if (! $user) {
			throw new \LogicException('There is no user to attach the lock.');
		}
		
		$localization = $this->getPageLocalization();

		$currentRevision = $this->getAuditReader()
				->getCurrentRevision($localization::CN(), $localization->getId());

		$lock = new EditLock();

		$lock->setUserName($user->getUsername());
		$lock->setLocalizationRevision($currentRevision);

		$entityManager = $this->getEntityManager();

		$entityManager->persist($lock);
		$entityManager->flush();

		return $lock;
	}