public decimal DeleteDepartment(Department department, UIActionType UAT) { IList <Department> depList = this.GetDepartmentChildsByParentPath(department.ID); foreach (Department dep in depList) { if (dep.PersonList != null && dep.PersonList.Count > 0) { UIValidationExceptions exception = new UIValidationExceptions(); exception.Add(ExceptionResourceKeys.DepUsedByPersons, "این بخش به اشخاص انتساب داده شده است", ExceptionSrc); throw exception; } } departmentRepository.DelateHirenchicalByParentId(department.ID); return(base.SaveChanges(department, UAT)); }