public bool Delete(long userId, Employee toDelete) { using (var tran = new TransactionScope()) { //Check if employee has related user account if (BlUser.LoadByPin(userId, toDelete.Entity.Pin) != null) { throw new BusinessException("CannotDeleteRelatedUser"); } var toRet = _repository.Delete(toDelete); BlLog.Log(userId, Module, "Delete employee", "EmployeeDeleted", new object[] { toDelete.Entity.Pin, BlEntity.FormatFullName(toDelete.Entity) }); tran.Complete(); return(toRet); } }