private Task <T> Handle <T>(ITransactionHandler handler, BaseTransaction payload, Func <ITransactionHandler, BaseTransaction, Task <T> > handlerAction) where T : class, new() { if (handler == null) { _logger.LogWarning($"No handler found"); return(Task.FromResult(new T())); } _logger.LogInformation($"Handling {payload.GetType()} with handler {handler.GetType()}"); return(handlerAction(handler, payload)); }