protected function createResult(array &$data, $type = null) {
		if ($type === null) {
			$type = $this->getResultType();
		}

		if ($type & self::RESULT_ARRAY) {
			return $data;
		}

		if ($type & self::RESULT_OBJECT) {
			return (object) $data;
		}

		if ($type & self::RESULT_MODEL) {
			return $this->create($data);
		}

		throw new Exceptions\InvalidResultType('Nothing to do with the type #' . $type);
	}