class ModulesInvoker {

    static StartResult start(final ExecutionContext context, final Iterable<SagaModule> modules) {
        Exception possibleStartException = null;
        List<Supplier<Optional<Exception>>> finishers = new ArrayList<>();
        List<BiFunction<Object, Throwable, Optional<Exception>>> errorHandlers = new ArrayList<>();

        try {
            for (final SagaModule module : modules) {
                finishers.add(createFinisher(module, context));
                errorHandlers.add(createErrorHandler(module, context));

                module.onStart(context);
            }
        } catch (Exception ex) {
            possibleStartException = ex;
        }

        return new StartResult(possibleStartException, new ModulesInvoker(finishers, errorHandlers));
    }

    private  ModulesInvoker(
            final List<Supplier<Optional<Exception>>> finishers,
            final List<BiFunction<Object, Throwable, Optional<Exception>>> errorHandlers);

}