/**
  * Validates the settings form
  */
 private function validateForm()
 {
     if ($this->frm->isSubmitted()) {
         if ($this->frm->isCorrect()) {
             $enabled = (bool) $this->frm->getField('enabled')->getValue();
             BackendModel::setModuleSetting($this->URL->getModule(), 'enabled', $enabled);
             if ($enabled) {
                 BackendModel::subscribeToEvent('Formbuilder', 'after_submission', 'FormBuilderMailer', array('\\Backend\\Modules\\FormBuilderMailer\\Engine\\Model', 'afterFormSubmission'));
             } else {
                 BackendModel::unsubscribeFromEvent('Formbuilder', 'after_submission', 'FormBuilderMailer');
             }
             BackendModel::setModuleSetting($this->URL->getModule(), 'log', (bool) $this->frm->getField('log')->getValue());
             BackendModel::setModuleSetting($this->URL->getModule(), 'add_data', (bool) $this->frm->getField('add_data')->getValue());
             BackendModel::triggerEvent($this->getModule(), 'after_saved_settings');
             $this->redirect(BackendModel::createURLForAction('settings') . '&report=saved');
         }
     }
 }