public static function Update($ID, &$arFields, $options = null)
 {
     global $DB;
     self::ClearErrors();
     if (!is_array($options)) {
         $options = array();
     }
     if (!self::CheckFields('UPDATE', $arFields, $ID)) {
         return false;
     }
     if (isset($arFields['SCOPE']) && !CCrmMailTemplateScope::IsDefined($arFields['SCOPE'])) {
         $arFields['SCOPE'] = CCrmMailTemplateScope::Personal;
     }
     if (isset($arFields['CREATED'])) {
         unset($arFields['CREATED']);
     }
     if (isset($arFields['LAST_UPDATED'])) {
         unset($arFields['LAST_UPDATED']);
     }
     $arFields['~LAST_UPDATED'] = $DB->CurrentTimeFunction();
     if (isset($arFields['AUTHOR_ID'])) {
         unset($arFields['AUTHOR_ID']);
     }
     $currentUserID = isset($options['CURRENT_USER_ID']) ? intval($options['CURRENT_USER_ID']) : CCrmPerms::GetCurrentUserID();
     if (!isset($arFields['EDITOR_ID'])) {
         $arFields['EDITOR_ID'] = $currentUserID;
     }
     $arRecordBindings = array();
     if (isset($arFields['BODY'])) {
         $arRecordBindings['BODY'] = $arFields['BODY'];
     }
     $tableName = CCrmMailTemplate::TABLE_NAME;
     $sql = 'UPDATE ' . $tableName . ' SET ' . $DB->PrepareUpdate($tableName, $arFields) . ' WHERE ID = ' . $ID;
     if (!empty($arRecordBindings)) {
         $DB->QueryBind($sql, $arRecordBindings, false);
     } else {
         $DB->Query($sql, false, 'File: ' . __FILE__ . '<br>Line: ' . __LINE__);
     }
     $rsEvents = GetModuleEvents('crm', 'OnMailTemplateUpdate');
     while ($arEvent = $rsEvents->Fetch()) {
         ExecuteModuleEventEx($arEvent, array($ID, &$arFields));
     }
     return true;
 }