private void CreateAppointment()
        {
            string      title       = titleTextBox.Text;
            string      description = descriptionTextBox.Text;
            TimeSpan    startTime   = startTimePicker.Value.TimeOfDay;
            TimeSpan    endTime     = endTimePicker.Value.TimeOfDay;
            DateTime    date        = datePicker.Value;
            Appointment appointment = new Appointment(title, description, startTime, endTime, date);

            Calendar.SaveAppointment(appointment);
        }
        private void CreateAppointment()
        {
            string      title           = titleTextBox.Text;
            string      description     = descriptionTextBox.Text;
            TimeSpan    startTime       = startTimePicker.Value.TimeOfDay;
            TimeSpan    endTime         = endTimePicker.Value.TimeOfDay;
            DateTime    date            = datePicker.Value;
            List <User> invitedUsers    = new List <User> {
            };
            List <string> selectedUsers = usersListBox.SelectedItems.Cast <string>().ToList();

            foreach (string username in selectedUsers)
            {
                invitedUsers.Add(Calendar.Users.Find(user => user.UserName == username));
            }
            Appointment appointment = new Appointment(title, description, startTime, endTime, date, Calendar.CurrentUser, invitedUsers);

            Calendar.SaveAppointment(appointment);
        }