public async Task UpdateBranch(Guid appId) { var branchIdList = _dataService.GetDto <BranchListDTO>(x => x.ApplicationId == appId).Select(x => x.Id); var branchList = _dataService.GetEntity <Branch>(x => branchIdList.Contains(x.Id) && x.CreateDls == false && x.RecordState != RecordState.D).ToList(); if (branchList.Any()) { branchList.ForEach(x => x.CreateTds = true); try { await _limsExchangeService.CreateTdsAsync(appId); } catch (Exception e) { branchList.ForEach(x => x.CreateTds = false); } await _dataService.SaveChangesAsync(); } }