protected function addSessionLock(Lock $lock) {
    $locks = $this->getSessionLocks();
    $locks[$lock->getObjectId()->__toString()] = $lock;
    $this->session->set(self::SESSION_VARNAME, $locks);
  }