public function storeSession(Session $session)
 {
     $context = new Context();
     if (!$context->IsCliInvocation) {
         session_start();
     }
     $namespace = $session->getNamespace();
     $_SESSION[$namespace] = $session->exportRawData();
     // Close the session to make sure we aren't locking other process for this user, e.g.
     // simultaneous AJAX requests.
     if (!$context->IsCliInvocation) {
         session_write_close();
     }
 }