private void Btn_AddCategorySave_Click(object sender, RoutedEventArgs e) { if (string.IsNullOrEmpty(TxtBx_CategorTitle.Text)) { MessageBox.Show("Please enter a category name before clicking the Save button."); } else { CategoryModel category = new CategoryModel(TxtBx_CategorTitle.Text); category.AddToDb(); Close(); } }