public function fetchAs($stmt, $type = null)
    {
        $data = [];

        if ((is_null($type) || $type == '') && static::$dataSource) {
            $type = 'class';
            static::$dataSource = false;
        }

        switch (strtolower($type)) {
            case 'group':
                $data = $stmt->fetchAll(\PDO::FETCH_GROUP | \PDO::FETCH_ASSOC);
                break;
            case 'both':
                $data = $stmt->fetchAll(\PDO::FETCH_BOTH);
                break;
            case 'object':
                $data = $stmt->fetchAll(\PDO::FETCH_OBJ);
                break;
            case 'assoc':
                $data = $stmt->fetchAll(\PDO::FETCH_ASSOC);
                break;
            case 'column':
                $data = $stmt->fetchAll(\PDO::FETCH_COLUMN);
                break;
            case 'class':
                $data = $stmt->fetchAll(\PDO::FETCH_CLASS, '\\Cygnite\\Database\\ResultSet');
                break;
            default:
                $data = $stmt->fetchAll(\PDO::FETCH_CLASS, '\\'.self::cyrus()->getModelClassNs());
                break;
        }

        return $data;
    }