/**
  * @return array
  *
  * @throws \MailSo\Base\Exceptions\Exception
  */
 public function DoTemplateSetup()
 {
     $oAccount = $this->getAccountFromToken();
     if (!$this->GetCapa(false, \RainLoop\Enumerations\Capa::TEMPLATES, $oAccount)) {
         return $this->FalseResponse(__FUNCTION__);
     }
     $oTemplate = \RainLoop\Model\Template::NewInstance();
     if (!$oTemplate->FromJSON($this->GetActionParams(), true)) {
         throw new \RainLoop\Exceptions\ClientException(\RainLoop\Notifications::InvalidInputArgument);
     }
     if ('' === $oTemplate->Id()) {
         $oTemplate->GenerateID();
     }
     $aTemplatesForSave = array();
     $aTemplates = $this->GetTemplates($oAccount);
     foreach ($aTemplates as $oItem) {
         if ($oItem && $oItem->Id() !== $oTemplate->Id()) {
             $aTemplatesForSave[] = $oItem;
         }
     }
     $aTemplatesForSave[] = $oTemplate;
     return $this->DefaultResponse(__FUNCTION__, $this->SetTemplates($oAccount, $aTemplatesForSave));
 }