public function render($view = null, $layout = null) {
		$dataToSerialize = [
			'error' => null,
			'content' => null,
		];

		if (!empty($this->viewVars['error'])) {
			$view = false;
		}

		if ($view !== false && !isset($this->viewVars['_redirect']) && $this->_getViewFileName($view)) {
			$dataToSerialize['content'] = parent::render($view, $layout);
		}

		$this->viewVars = Hash::merge($dataToSerialize, $this->viewVars);

		if (isset($this->viewVars['_serialize'])) {
			$dataToSerialize = $this->_dataToSerialize($this->viewVars['_serialize'], $dataToSerialize);
		}

		return $this->_serialize($dataToSerialize);
	}