public async Task <Guid> Persist(InstructionsMatchedEvent instructionsMatchedEvent, CancellationToken ct) { var transfer = Map(instructionsMatchedEvent); using var session = await _db.Client.StartSessionAsync(null, ct); await _transferInstructions.DeleteManyAsync(x => x.Id == instructionsMatchedEvent.ReleasingInstructionId || x.Id == instructionsMatchedEvent.EngagingInstructionId, ct); await _transfers.InsertOneAsync(transfer, null, ct); return(transfer.Id); }
private Transfer Map(InstructionsMatchedEvent instructionsMatchedEvent) => new()