protected virtual CommandHandlers OnResolveCommandHandlers(AssemblyScanConfig[] assembliesWithCommandHandlers)
        {
            var commandHandlers = new CommandHandlers();
            foreach (var assembly in assembliesWithCommandHandlers)
                commandHandlers.Register(new AssemblyCommandHandlerResolver(assembly).Resolve());

            return commandHandlers;
        }
        public ICqrsRuntime Build(
            AssemblyScanConfig[] assembliesWithCommandHandlers,
            AssemblyScanConfig[] assembliesWithEventHandlers)
        {
            var commandHandlers = OnResolveCommandHandlers(assembliesWithCommandHandlers);
            var eventHandlers = OnResolveEventHandlers(assembliesWithEventHandlers);

            return new CqrsRuntime
            (
                CommandBusFactory.Invoke(commandHandlers),
                EventStoreFactory.Invoke(),
                EventApplierFactory.Invoke(),
                EventPublisherFactory.Invoke(eventHandlers)
            );
        }
        protected virtual EventHandlers OnResolveEventHandlers(AssemblyScanConfig[] assembliesWithEventHandlers)
        {
            var eventHandlers = new EventHandlers();
            foreach (var assembly in assembliesWithEventHandlers)
                eventHandlers.Register(new AssemblyEventHandlerResolver(assembly).Resolve());

            return eventHandlers;
        }