private void Save() { if (Helpers.CheckEmpty(errorProvider1, txtName, txtEmail, txtPhone, txtLocation)) { return; } else { SaveCompleted = true; errorProvider1.Clear(); BranchEntity branchEntity = new BranchEntity(); branchEntity.Name = txtName.Text; branchEntity.Email = txtEmail.Text; branchEntity.Phone = txtPhone.Text; branchEntity.Location = txtLocation.Text; branchEntity.Active = chkActive.Checked; branchEntity.CompanyId = (Guid)cboCompany.SelectedValue; if (BranchID != Guid.Empty) { branchEntity.Id = BranchID; branchEntity.Update(USER.UserName); BranchDao.Update(branchEntity); } else { branchEntity.Id = Guid.NewGuid(); branchEntity.Create(USER.UserName); BranchDao.Insert(branchEntity); } } }