public void DeleteUserDepartment(int Id) { using (IUnitOfWork work = UnitOfWork.Begin()) { UserDepartment userDepartment = _userDepartmentRepository.FindById(Id); userDepartment.IsDeleted = true; var message = new XElement(XMLLogLiterals.LOG_MESSAGE); message.Add(XMLLogMessageHelper.TemplateToXml("LogMessageUserRemovedFromDepartment", new List <string> { userDepartment.User.LoginName, userDepartment.Department.Name })); work.Commit(); _logService.CreateLog(CurrentUser.Get().Id, "web", flag, CurrentUser.Get().HostName, CurrentUser.Get().CompanyId, message.ToString()); } }