code: public function persist(QtiRunnerServiceContext $context)
      {
          $testSession = $context->getTestSession();
          $sessionId = $testSession->getSessionId();
  
          \common_Logger::d("Persisting QTI Assessment Test Session '${sessionId}'...");
          $context->getStorage()->persist($testSession);
          if($this->isTerminated($context)){
              $userId = \common_session_SessionManager::getSession()->getUser()->getIdentifier();
              $eventManager = $this->getServiceManager()->get(EventManager::SERVICE_ID);
              $eventManager->trigger(new AfterAssessmentTestSessionClosedEvent($testSession, $userId));
          }
      }
docs: Persists the AssessmentTestSession into binary data.
  @param QtiRunnerServiceContext $context