private async void btnCreate_Click(object sender, EventArgs e) { if (IsValidForm()) { //Create new department DepartmentModel department = new DepartmentModel() { DepartmentName = txtName.Text.Trim().ToLower() }; if (txtEmail.Text.Trim() != string.Empty) { department.Email = txtEmail.Text.Trim(); } if (txtAddress.Text.Trim() != string.Empty) { department.Address = txtAddress.Text.Trim().ToLower(); } department.DepartmentName = CultureInfo.CurrentCulture.TextInfo.ToTitleCase(department.DepartmentName); //Save department into the database department = await _department.CreateDepartment(department); Logger.WriteToFile(Logger.FullName, "successfully created new department"); MessageBox.Show($"{department.DepartmentName} has been successfully created", "Create", MessageBoxButtons.OK, MessageBoxIcon.Information); PopulateGrid(); btnReset_Click(this, null); } }