@Override
    public void publish(Command command){
        Class<? extends Command> type = command.getClass();
        List<Object> handlers = eventHandlers.get(command.getClass());
        if(handlers == null){
            LOG.info("No command handlers declared for command " + type.getName());
            return;
        }
        for(Object handler : handlers){
            for(Method method : handler.getClass().getMethods())
            {
                if(method.isAnnotationPresent(CommandHandler.class) &&
                        method.getParameterTypes().length == 1  &&
                        method.getParameterTypes()[0].equals(command.getClass())){
                    try {
                        method.invoke(handler, command);
                    } catch (IllegalAccessException e) {
                        e.printStackTrace();
                        throw new RuntimeException(e);
                    } catch (InvocationTargetException e) {
                        e.printStackTrace();
                        throw new RuntimeException(e);
                    }
                }
            }
        }
    }