public function resolve($query)
    {
        $queryClassName = self::findBaseName($query);
    
        if ($query instanceof ICommand) {
            
            if (isset($this->commandHandlers[$queryClassName])) {
                return $this->commandHandlers[$queryClassName];
            }
            
            throw new HandlerNotFoundException($queryClassName);
        }
        
        // if its not a command, then it must be a query
        if (isset($this->queryHandlers[$queryClassName])) {
            return $this->queryHandlers[$queryClassName];
        }
        
        throw new HandlerNotFoundException($queryClassName);
    }