public async Task <FilterDetailsDto> Update(int id, FilterUpdateDto updateDto) { var updateFilter = _domainService.Find(id); if (updateFilter == null) { throw SocialExceptions.FilterNotExists(id); } if (updateDto.IfPublic == false && updateFilter.IfPublic == true) { updateFilter.CreatedBy = UserContext.UserId; } _domainService.DeleteConditons(updateFilter); Mapper.Map(updateDto, updateFilter); _domainService.UpdateFilter(updateFilter, Mapper.Map <List <FilterConditionCreateDto>, List <FilterCondition> >(updateDto.Conditions.ToList()).ToArray()); using (var uow = UnitOfWorkManager.Begin(TransactionScopeOption.RequiresNew)) { CurrentUnitOfWork.SaveChanges(); uow.Complete(); } await _notificationManager.NotifyUpdateFilter(updateFilter.SiteId, updateFilter.Id); var filterDto = Mapper.Map <FilterDetailsDto>(updateFilter); List <FilterDetailsDto> filterDtos = new List <FilterDetailsDto>(); filterDtos.Add(filterDto); _agentService.FillCreatedByName(filterDtos); return(filterDto); }