/**
  * update
  *
  * @access protected
  * @return
  */
 protected function update()
 {
     global $ilErr;
     $single_editing = $_REQUEST['rexl'] ? true : false;
     $this->load($this->app->isMilestone());
     if ($this->app->validate() and $this->notification->validate()) {
         if (!(int) $_POST['calendar']) {
             $cat_id = $this->createDefaultCalendar();
         } else {
             $cat_id = (int) $_POST['calendar'];
         }
         if ($single_editing) {
             $this->getAppointment()->save();
             $this->deleteExclude(false);
             $this->rec = new ilCalendarRecurrence();
             $this->rec->setEntryId($this->getAppointment()->getEntryId());
         } else {
             $this->getAppointment()->update();
         }
         $this->notification->save();
         $this->saveRecurrenceSettings();
         include_once './Services/Calendar/classes/class.ilCalendarCategoryAssignments.php';
         $ass = new ilCalendarCategoryAssignments($this->app->getEntryId());
         $GLOBALS['ilLog']->write($this->app->getEntryId());
         $ass->deleteAssignments();
         $ass->addAssignment($cat_id);
         // Send notifications
         include_once './Services/Calendar/classes/class.ilCalendarSettings.php';
         if (ilCalendarSettings::_getInstance()->isNotificationEnabled() and (bool) $_POST['not']) {
             $this->distributeNotifications($cat_id, $this->app->getEntryId(), false);
         }
         if (ilCalendarSettings::_getInstance()->isUserNotificationEnabled()) {
             $this->distributeUserNotifications();
         }
         ilUtil::sendSuccess($this->lng->txt('settings_saved'), true);
         $this->ctrl->returnToParent($this);
     } else {
         ilUtil::sendFailure($ilErr->getMessage());
     }
     $this->edit();
 }