private static async Task Execute( InMemoryEventStore store, string streamName, Func <EventData[], IEvent[]> f, Func <IEvent[], Task> pub) { var r = await store.LoadEventStreamAsync(streamName, 0); var events = f(r.Events.ToArray()); _ = await store.AppendToStreamAsync(streamName, r.Version, events); await pub(events); }