/**
  * Api to create user
  * @param String $sUserName
  * @param String $sPassword
  * @param String $sFullName
  * @param array of Strings $aGroups
  * @param array $aOptions
  * @return Doctrine_Record
  */
 public function createUser($sUserName, $sPassword, $sFullName = "", $aGroups = array(), $aOptions = array(), $bSendEmail = true)
 {
     //var_dump($aOptions);
     $this->checkMe();
     $bVerifyEmail = isset($aOptions["verifyemail"]) ? $aOptions["verifyemail"] : FlexiConfig::$bRequireEmailVerification;
     if ($bVerifyEmail && empty(FlexiConfig::$sSupportEmail)) {
         throw new FlexiException("Support e-mail not set: " . FlexiConfig::$sSupportEmail, ERROR_CONFIGURATION);
     }
     $oModel = FlexiModeUtil::getRedbeanModel(FlexiConfig::$sDBPrefix . "users");
     $oModel->user_name = $sUserName;
     $oModel->password = md5($sPassword);
     $oModel->first_name = $sFullName;
     $oModel->email = $aOptions["email"];
     $oModel->date_registered = FlexiDateUtil::getSQLDateNow();
     $oModel->deleted = "N";
     FlexiModelUtil::getInstance()->insertRedBean($oModel);
     if (!empty($oModel->email) && $bVerifyEmail) {
         $oView = new FlexiView();
         $sMessage = $oView->render("user.verify", array("fullname" => $sFullName, "module" => "FlexiLogin", "method" => "verify", "params" => array("id" => $oModel->id, "r" => $oModel->Extend->verifycode)));
         $sSubject = "Verification required";
         $oMail = FlexiMailer::getInstance();
         $oMail->setFrom(FlexiConfig::$sSupportEmail);
         $oMail->mail($sSubject, $sMessage, $oModel->Attributes->email);
         // sendMailMessage($oModel->Attributes->email, $oModel->username, $sPassword, $oModel->Attributes->fullname);
     }
     return $oModel;
 }