public function handleAction($action, $params, $raw = false)
    {
        $this->setupTemplate($this->className, $action);
        $output = parent::handleAction($action, $params, true);

        // No output and no template set:
        if (empty($output) && empty($this->template)) {
            throw new \Exception('No output or template for ' . $this->className . '.' . $action);
        }

        // No output, but we do have a legacy view to render:
        if (empty($output) && !empty($this->view)) {
            $output = $this->view->render();
        }

        // Has output, handle legacy style layout for it:
        if (!empty($output) && $this->response->hasLayout()) {
            $this->template->output = $output;
        }
        
        if (!empty($output) && !$this->response->hasLayout()) {
            return $output;
        }

        $this->template->set('title', $this->title);
        $this->template->set('subtitle', $this->subtitle);
        $this->template->set('breadcrumb', $this->breadcrumb);

        $this->response->setContent($this->template->render());
        return $this->response;
    }