public function export($id = null, $type = 'docx') {
		$type = mb_strtolower($type);
		if (!empty($type) && !$this->_controller->RequestHandler->prefers($type)) {
			throw new BadRequestException(__d('view_extension', 'Invalid request'));
		}

		if (!method_exists($this->_model, 'generateExportFile') || !method_exists($this->_model, 'getExportFilename')) {
			throw new InternalErrorException(__d('view_extension', 'Export method not found'));
		}

		$tempFile = $this->_model->generateExportFile($id);
		if (empty($tempFile)) {
			throw new InternalErrorException(__d('view_extension', 'Invalid generated file'));
		}

		$exportFile = pathinfo($tempFile, PATHINFO_FILENAME);

		return $this->download($id, $exportFile);
	}