public void SetAppointmentStatus(AppointmentStatus status, DateTime date)
        {
            var instance = AppointmentInstances.FirstOrDefault(a => a.Date.Date == date.Date);

            if (instance == null)
            {
                throw new InvalidOperationException("Appointment instance doesn't exist for this date");
            }
            if (status.Name == AppointmentStatus.Confirmed.Name)
            {
                instance.Confirm();
            }
            else if (status == AppointmentStatus.InProgress)
            {
                instance.SetInProgress();
            }
            else if (status == AppointmentStatus.Completed)
            {
                instance.Complete();
            }
            else if (status == AppointmentStatus.Cancelled)
            {
                instance.Cancel();
            }
        }
 public AppointmentInstance Cancel()
 {
     AppointmentStatus = AppointmentStatus.Cancelled;
     return(this);
 }
 public AppointmentInstance Complete()
 {
     AppointmentStatus = AppointmentStatus.Completed;
     return(this);
 }
 public AppointmentInstance SetInProgress()
 {
     AppointmentStatus = AppointmentStatus.InProgress;
     return(this);
 }
 public AppointmentInstance Confirm()
 {
     AppointmentStatus = AppointmentStatus.Confirmed;
     return(this);
 }