private void NewUserButton_Click(object sender, EventArgs e)
        {
            var dialog = new EditUserDialog();

            if (dialog.ShowDialog() == DialogResult.OK)
            {
                UsersListBox.Items.Add(dialog.Result);
            }
        }
        private void EditUserButton_Click(object sender, EventArgs e)
        {
            if (UsersListBox.SelectedItem == null)
            {
                return;
            }

            var dialog = new EditUserDialog(UsersListBox.SelectedIndex != 0, UsersListBox.SelectedItem as User);

            DialogResult result = dialog.ShowDialog();

            if (result == DialogResult.OK)
            {
                UsersListBox.Items[UsersListBox.SelectedIndex] = dialog.Result;
            }
            else if (result == DialogResult.No) // Remove student
            {
                UsersListBox.Items.Remove(UsersListBox.SelectedItem);
            }
        }