public static async Task HandleUpdateCommand <TCommand, TEntity>( EventStoreClient eventStore, Func <TEntity> getDefault, Func <TEntity, object, TEntity> when, Func <TCommand, TEntity, object> handle, Func <TCommand, string> getId, Func <TCommand, uint> getVersion, TCommand command, CancellationToken ct) where TEntity : notnull { var id = getId(command); var entity = await eventStore.Find(getDefault, when, id, ct); var @event = handle(command, entity); await eventStore.Append(id, @event, getVersion(command), ct); }