private IEnumerable<Location> FindLocations(SqlMapper.GridReader multi)
 {
     var locations = multi.Read<Location>();
     var sales = multi.Read<SaleInstance>();
     foreach (var location in locations)
         location.Sales = sales.Where(s => s.SaleId == location.SaleId).ToList();
     return locations;
 }
 /// <summary>
 /// Creates a new <see cref="HistoryStatusCountsRecord"/> by reading from the given multi-mapped reader.
 /// </summary>
 /// <param name="multi">The multi-mapped reader to read from.</param>
 /// <returns>A new <see cref="HistoryStatusCountsRecord"/>.</returns>
 private static HistoryStatusCountsRecord CreateHistoryStatusCounts(SqlMapper.GridReader multi)
 {
     return new HistoryStatusCountsRecord()
     {
         TotalCount = multi.Read<long>().First(),
         SucceededCount = multi.Read<long>().First(),
         FailedCount = multi.Read<long>().First(),
         CanceledCount = multi.Read<long>().First(),
         TimedOutCount = multi.Read<long>().First(),
         InterruptedCount = multi.Read<long>().First()
     };
 }
 /// <summary>
 /// Creates a new <see cref="CountsRecord"/> by reading from the given multi-mapped reader.
 /// </summary>
 /// <param name="multi">The multi-mapped reader to read from.</param>
 /// <returns>A new <see cref="CountsRecord"/>.</returns>
 private static CountsRecord CreateCounts(SqlMapper.GridReader multi)
 {
     return new CountsRecord()
     {
         HistoryCount = multi.Read<long>().FirstOrDefault(),
         QueueCount = multi.Read<long>().FirstOrDefault(),
         ScheduleCount = multi.Read<long>().FirstOrDefault(),
         WorkerCount = multi.Read<long>().FirstOrDefault(),
         WorkingCount = multi.Read<long>().FirstOrDefault()
     };
 }