protected function storeLock(Lock $lock) {
    if ($lock->getType() == Lock::TYPE_PESSIMISTIC) {
      // pessimistic locks must be stored in the database in order
      // to be seen by other users
      $lockObj = $this->persistenceFacade->create($this->lockType, BuildDepth::REQUIRED);
      $lockObj->setValue('objectid', $lock->getObjectId());
      $lockObj->setValue('login', $lock->getLogin());
      $lockObj->setValue('created', $lock->getCreated());
      // save lock immediatly
      $lockObj->getMapper()->save($lockObj);
    }
    // store the lock in the session for faster retrieval
    $this->addSessionLock($lock);
  }