public function beforeRender(Event $event)
    {
        $plugin = (string)Inflector::camelize($event->subject()->request->params['plugin']);
        $controller = Inflector::camelize($event->subject()->request->params['controller']);
        $action = Inflector::underscore($event->subject()->request->params['action']);
        $prefix = '';

        if (!empty($event->subject()->request->params['prefix'])) {
            $prefix = Inflector::camelize($event->subject()->request->params['prefix']) . '/';
        }

        $templatePath = Plugin::classPath($plugin) . "Template/{$prefix}{$controller}/{$action}.ctp";
        if (!is_readable($templatePath)) {
            $alternativeTemplatePath = Plugin::classPath('Comment') . 'Template/CommentUI';
            if (is_readable("{$alternativeTemplatePath}/{$action}.ctp")) {
                $this->plugin = 'Comment';
                $this->viewBuilder()->templatePath('CommentUI');
            }
        }

        parent::beforeRender($event);
    }