public async Task <bool> Insert(OrderAggregate orderAggregate) { if (orderAggregate == null) { throw new ArgumentNullException(nameof(orderAggregate)); } using (var transaction = await _context.Database.BeginTransactionAsync().ConfigureAwait(false)) { try { var record = orderAggregate.ToModel(); _context.Orders.Add(record); await _context.SaveChangesAsync().ConfigureAwait(false); transaction.Commit(); return(true); } catch { transaction.Rollback(); return(false); } } }