/**
  * return current session id
  *
  * @param boolean $generateUid
  * @return mixed|null
  */
 public static function getSessionId($generateUid = true)
 {
     if (!self::isRegistered(self::SESSIONID)) {
         $sessionId = null;
         // TODO allow to access Tinebase/Core methods with Setup session and remove this workaround
         if (Tinebase_Session::isStarted() && !Tinebase_Session::isSetupSession()) {
             $sessionId = Tinebase_Session::getId();
         }
         if (empty($sessionId)) {
             $sessionId = 'NOSESSION';
             if ($generateUid) {
                 $sessionId .= Tinebase_Record_Abstract::generateUID(31);
             }
         }
         self::set(self::SESSIONID, $sessionId);
     }
     return self::get(self::SESSIONID);
 }