public async Task <OperationStatusUpdateResultModel> AcceptBatchAsync(Dictionary <Guid, string> operationsHashesDict) { return(await _transactionScopeHandler.WithTransactionAsync(async() => { var operationRequestsDict = await _operationRequestsRepository.GetByIdsAsync(operationsHashesDict.Keys); var notInRequests = operationsHashesDict.Keys.Where(k => !operationRequestsDict.ContainsKey(k)).ToHashSet(); await _operationRequestsRepository.AcceptBatchAsync(operationRequestsDict.Values, operationsHashesDict); if (notInRequests.Any()) { var operationsIds = await _operationsRepository.GetExistingIdsAsync(notInRequests); foreach (var operationId in operationsIds) { notInRequests.Remove(operationId); } if (notInRequests.Any()) { _log.Warning("Operation request not found by id", context: new { missingIds = notInRequests }); return OperationStatusUpdateResultModel.Failed(OperationStatusUpdateError.OperationNotFound); } } _log.Info($"Accepted {operationRequestsDict.Count} operationss", new { operationIds = operationRequestsDict.Keys }); return OperationStatusUpdateResultModel.Succeeded(); })); }