public static async Task PublishAllUnPublishedEventsAsync(this IStateStore stateManager, Func <IEvent[], Task> publish) => await (await stateManager.GetAllUnPublishedEventsAsync()) .Pipe(async x => await stateManager.OnPublish(publish)(x));