private void btnFirmSave_Click(object sender, EventArgs e) { FirmService firmService = null; try { if (txtFirmName.Text == "" || txtFirmName.Text == null) { MessageBox.Show("Name is required!"); return; } else { if (!FirmNameValidation()) { firmService = new FirmService(); var firmName = txtFirmName.Text; firmService.SaveFirm(firmId, firmName); ClearFirmFieldsValues(); } } } catch (Exception ex) { MessageBox.Show(ex.Message, Comman.Product_Name, MessageBoxButtons.OK, MessageBoxIcon.Error); } finally { firmService = null; } }