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 Edit(int id)
        {
            iDiary Diary = new iDiary();

            try
            {
                if (Diary.GetAppointmentbyID(id))
                {
                    String.Format("{0:d/M/yyyy HH:mm}", Diary.Appointments[0].EndDate);
                    String.Format("{0:d/M/yyyy HH:mm}", Diary.Appointments[0].DueDate);

                    Diary.GetAllDiaryLogsbyID(id);
                }
                else
                {
                    Diary.Appointments = new List<DiaryAppointment>();
                    Diary.Reminders = new List<AquariumDiaryManagement.Reminder>();

                    Diary.Appointments.Add(new DiaryAppointment());
                    Diary.Reminders.Add(new AquariumDiaryManagement.Reminder());

                    Diary.Appointments[0].EndDate = DateTime.Now.AddDays(7);
                    Diary.Appointments[0].DueDate = DateTime.Now;
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }

            return View(Diary);
        }