public function invoke(ServerRequestInterface $request, RouteParams $params)
    {
        $callable = $this->callable;

        // Controller Actions are lazy loaded so we need to call the factory to get the callable
        if ($this->isControllerAction()) {
            $callable = call_user_func($this->callable);
        }

        // Call the target action with any provided params
        if ($this->invoker) {
            return $this->invoker->setRequest($request)->call($callable, $params->toArray());
        } else {
            return call_user_func($callable, $params);
        }
    }