public static function convertToPayjpObject($resp, $opts)
    {
        $types = array(
            'account' => 'Payjp\\Account',
            'card' => 'Payjp\\Card',
            'charge' => 'Payjp\\Charge',
            'customer' => 'Payjp\\Customer',
            'list' => 'Payjp\\Collection',
            'event' => 'Payjp\\Event',
            'token' => 'Payjp\\Token',
            'transfer' => 'Payjp\\Transfer',
            'plan' => 'Payjp\\Plan',
            'subscription' => 'Payjp\\Subscription',
        );
        if (self::isList($resp)) {
            $mapped = array();
            foreach ($resp as $i) {
                array_push($mapped, self::convertToPayjpObject($i, $opts));
            }
            return $mapped;
        } elseif (is_array($resp)) {
            if (isset($resp['object']) && is_string($resp['object']) && isset($types[$resp['object']])) {
                $class = $types[$resp['object']];
            } else {
                $class = 'Payjp\\PayjpObject';
            }
            return $class::constructFrom($resp, $opts);
        } else {
            return $resp;
        }
    }