private void SubmitButton_Click(object sender, EventArgs e) { switch (myState) { case FormState.Add: bool okayToAdd = ensureSafeProcess(); if (okayToAdd) { guest = PopulateGuest(); guestController.Add(guest); if (accountForm == null) { CreateNewAccountForm(); } if (accountForm.accountFormClosed) { CreateNewAccountForm(); } accountForm.FormDisplay("add"); accountForm.Show(); this.Close(); } break; case FormState.Edit: bool okayToEdit = ensureSafeProcess(); if (okayToEdit) { guest = PopulateGuest(); guestController.Edit(guest); this.Close(); } break; } }