protected function ensureExistingTestSession(ilTestSession $testSession)
 {
     if ($testSession->getActiveId()) {
         return;
     }
     global $ilUser;
     $testSession->setUserId($ilUser->getId());
     if ($testSession->isAnonymousUser()) {
         if (!$testSession->doesAccessCodeInSessionExists()) {
             return;
         }
         $testSession->setAnonymousId($testSession->getAccessCodeFromSession());
     }
     $testSession->saveToDb();
 }