public object Modify(object applicationMessage) { var fundingSourceEvent = applicationMessage as IFundingSourcePaymentEvent; return(fundingSourceEvent == null ? applicationMessage : mapper.Map(fundingSourceEvent)); }
public async Task StoreFundingSourceEvents(List <FundingSourceEventModel> models, CancellationToken cancellationToken) { try { await repository.SaveFundingSourceEvents(models, cancellationToken); } catch (Exception e) { if (!e.IsUniqueKeyConstraintException() && !e.IsDeadLockException()) { throw; } logger.LogInfo($"Batch contained a duplicate required payment. Will store each individually and discard duplicate."); await repository.SaveFundingSourceEventsIndividually(models.Select(model => mapper.Map(model)).ToList(), cancellationToken).ConfigureAwait(false); } }