public function convert($type, $data)
    {
        foreach ($data as $k => $v) {
            if (is_array($v)) {
                $data[$k] = $this->convert($type, $v);
            }
        }

        switch (strtolower($type)) {
        case 'array':
            return (array) $data;
            break;
        case 'object':
            return (object) $data;
            break;
        default:
            throw new \Exception('Invalid conversion type given!');
        }
    }