/// <summary>
        /// Called when the user clicks okay. Performs validation and saves the data either into a new 
        /// task or into task we are editing.
        /// </summary>
        protected void okBtn_Click(object sender, System.EventArgs e)
        {
            try
            {
                Task task = GetTask();
                bool isNewTask = (task == null);

                if (isNewTask)
                    task = new Task();

                EditTaskController controller = new EditTaskController();
                controller.Save(GetTaskData(), task);

                if (isNewTask)
                    this.model.AddTask(task);

                Response.Redirect(ViewState["referrer"].ToString());
            }
            catch (ValidateException ex)
            {
                validationLabel.Text = ex.Message;
                validationLabel.Visible = true;
            }
        }
 private void UpdateiCalendar()
 {
     try
     {
         Task dummyTask = new Task();
         EditTaskController controller = new EditTaskController();
         controller.Save(GetTaskData(), dummyTask);
         iCalendarText.Text = dummyTask.Pattern.ToiCalendar();
     }
     catch (Exception ex)
     {
         this.iCalendarText.Text = ex.Message;
     }
 }