private void CommitButton_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                //string roleDescription = "";
                string roleCode = "";
                //string defaultEntityName = "";
                int    defaultEntityID = 0;
                bool   active          = (ActiveCheckBox.IsChecked == true);
                string passwd          = NewPassword.Password;

                if (RoleCombo.SelectedItem != null)
                {
                    StaffRoles role = (StaffRoles)RoleCombo.SelectedItem;
                    roleCode = role.RoleCode;
                }
                if (EntityCombo.SelectedItem != null)
                {
                    Entities defaultEntity = (Entities)EntityCombo.SelectedItem;
                    defaultEntityID = defaultEntity.ID;
                }

                if (passwd != "" && passwd != ConfirmPassword.Password)
                {
                    MessageFunctions.InvalidMessage("New password does not match confirmation. Please check both fields and try again.", "Password Mismatch");
                    return;
                }

                int returnID = StaffFunctions.SaveStaffDetails(selectedStaffID, FirstName.Text, Surname.Text, roleCode, StartDate.SelectedDate, LeaveDate.SelectedDate,
                                                               UserID.Text, passwd, active, defaultEntityID, (SSOCheckBox.IsChecked == true), DomainUser.Text);

                if (returnID > 0)
                {
                    if (selectedStaffID == 0)
                    {
                        MessageFunctions.SuccessAlert("New staff member created successfully.", "Staff details saved");
                        selectedStaffID = returnID;
                    }
                    else
                    {
                        MessageFunctions.SuccessAlert("Changes saved successfully.", "Staff member amended");
                    }
                    StaffFunctions.ReturnToStaffPage(selectedStaffID);
                }
            }
            catch (Exception generalException) { MessageFunctions.Error("Error saving details", generalException); }
        }