protected function checkLock($createOnMiss = true)
	{
		$this->isPostRequest();

		$user = $this->getCurrentUser();

		if (! $user) {
			return;
		}

		$localization = $this->getPageLocalization();

		if ($localization->isLocked()) {

			$lock = $localization->getLock();
			
			if ($lock->getUserName() !== $user->getUsername()) {
				throw new ObjectLockedException('page.error.page_locked', 'Page is locked by another user');
			} else {

				$entityManager = $this->getEntityManager();

//				if ( ! $this->lockTransactionOpened) {
//					$entityManager->beginTransaction();
//
//					$this->lockTransactionOpened = true;
//				}
				
//				$entityManager->lock($lock, \Doctrine\DBAL\LockMode::PESSIMISTIC_READ);

				$lock->setModificationTime(new \DateTime('now'));
				
				$entityManager->flush($lock);
			}
		} elseif ($createOnMiss) {

//			$entityManager = $this->getEntityManager();

//			if ( ! $this->lockTransactionOpened) {
//				$entityManager->beginTransaction();
//				$this->lockTransactionOpened = true;
//			}

			// Creates lock if doesn't exist
//			$entityManager->lock(
//					$this->createLock(),
//					\Doctrine\DBAL\LockMode::PESSIMISTIC_READ
//			);
		}
	}