public function createSession() {
        if (!isset($_SESSION)) {
           if (PHP_SAPI === 'cli') {
              $_SESSION = array();
           } elseif (!headers_sent()) {
              if (!session_start()) {
                 throw new SessionException('session_start failed.');
              }
           } else {
              throw new SessionException('Session started after headers sent.');
           }
        }
        $mmfSession = new Session($_SESSION);
        return $mmfSession;
    }