public function dispatch($action, ServerRequestInterface $request) : ResponseInterface
    {
        $this->getLogger()->debug('dispatching to action: '.$action);
        if (!method_exists($this, $action) && !method_exists($this, '__call')) {
            throw new ActionDoesNotExistException();
        }

        $response = $this->$action($request);
        return $response;
    }