public ActionResult Edit(iDiary iDiary)
        {
            iDiary.Appointments[0].CreatedBy = iDiary.Reminders[0].ClientPersonnelID;

            try
            {
                if (iDiary.AddDiaryAppointment())
                {
                    iDiary.AddDiaryLog(iDiary.Appointments[0].DiaryAppointmentID, 3, DateTime.Now, iDiary.Appointments[0].CreatedBy, "Task Updated");
                    iDiary.GetAllLeads();
                    iDiary.GetAllUsers();
                    iDiary.GetAllTimeshiftValues();
                    iDiary.GetAllDiaryTitles();
                    iDiary.GetDefaultDiaryText();
                    iDiary.GetAllDiaryLogsbyID(iDiary.Appointments[0].DiaryAppointmentID);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }

            return View(iDiary);
        }
        public ActionResult Complete(int id)
        {
            iDiary Diary = new iDiary();

            try
            {
                if (Diary.GetAppointmentbyID(id))
                {
                    Diary.Appointments[0].Completed = true;
                    Diary.Appointments[0].EndDate = DateTime.Now;

                    Diary.AddDiaryAppointment();
                    Diary.AddDiaryLog(Diary.Appointments[0].DiaryAppointmentID, 5, DateTime.Now, Diary.Appointments[0].CreatedBy, "Task Completed");
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }

            return RedirectToAction("Index", "iDiary");
        }