public void AddAppointment(Appointment e) { try { storage.createAppointment(e.Title, e.StartTime, e.EndTime); foreach (Day d in AllDays) { if (d.Date.Date.Equals(e.AppointmentDate.Date)) { d.AddEvent(e); storage.createAppointment(e.Title, e.StartTime, e.EndTime); return; } } Day newDay = new Day(e.AppointmentDate); newDay.AddEvent(e); AllDays.Add(newDay); Days.Add(newDay); } catch (Exception ex) { throw ex; } }