public void EmailSender()
        {
            while (_running)
            {
                foreach (Appointment appointment in _appointments)
                {
                    DateTime now = DateTime.Now;
                    double   hoursToAppointment = appointment.NotificationTime.TotalHours;

                    if (appointment.DateAndTime > now &&
                        appointment.DateAndTime <= now.AddHours(hoursToAppointment) &&
                        appointment.EmailNotification)
                    {
                        foreach (User user in appointment.Participants)
                        {
                            if (_clientRepo.IsClient(user))
                            {
                                _mailNotification.SendReminderEmail(appointment, user as Client);
                                appointment.EmailNotification = false;
                                _persistable.EditAppointment(appointment);
                            }
                        }
                    }
                }
                Thread.Sleep(TimeSpan.FromMinutes(1));
            }
        }
        public void EditAppointment(AppointmentView appointmentView)
        {
            lock (_lockingObject)
            {
                Appointment appointment     = new Appointment(appointmentView.Id, appointmentView.DateAndTime, appointmentView.Note, appointmentView.NotificationTime, appointmentView.EmailNotification, appointmentView.SMSNotification);
                Appointment tempAppointment = _appointments.Find(appointmentOne => appointmentOne.Id == appointmentView.Id);

                tempAppointment.DateAndTime       = appointmentView.DateAndTime;
                tempAppointment.Note              = appointmentView.Note;
                tempAppointment.EmailNotification = appointment.EmailNotification;
                tempAppointment.SmsNotification   = appointment.SmsNotification;
                tempAppointment.NotificationTime  = appointment.NotificationTime;

                _updateAppointmentNotification.AppointmentUpdatedNotification(tempAppointment);

                _persistable.EditAppointment(tempAppointment);
                AppointmentsChangedEventHandler?.Invoke(appointment, EventArgs.Empty);
            }
        }