public function respondWith($var)
    {
        if (!$this->respondTo) {
            throw new Exception\RuntimeException(
                "In order to use respondWith, first you need to declare the formats your controller responds to in the respondTo property"
            );
        }
        
        $format = $this->request()->format();
        
        if (in_array($format, $this->respondTo)) {
            try {
                $this->render();
            } catch (TemplateMissingException $e) {
                if ($format != 'html' && $format != 'js') {
                    $rendering = new Rendering($this);
                    $body = $rendering->renderSerialized($var, $format);
                    $this->response()->setBody($body);
                } else {
                    throw $e;
                }
            }
        }
        
        if (!$this->isPerformed()) {
            $this->head(406);
        }
    }