private static IEnumerable <T> ReadResult <T>(IEventStoreConnection connection, string streamName, long lastEventNumber) { var result = new List <T>(); do { var events = connection.ReadStreamEventsBackwardsAsync(streamName, (int)lastEventNumber); result.AddRange(events.Result.Events.Select(e => e.ParseJson <T>())); lastEventNumber = events.Result.NextEventNumber; } while (lastEventNumber != -1); return(result); }