public static function arrayToObject($resp, $opts = null)
    {
        if (self::isIndexedArray($resp)) {
            $objArray = array();
            foreach ($resp as $val) {
                array_push($objArray, self::arrayToObject($val, $opts));
            }
            return $objArray;
        } elseif (is_array($resp)) {
            if (isset($resp['object']) &&
                # Event object may have object property as array, remove this case.
                !is_array($resp['object']) &&
                isset(self::$classes[$resp['object']])) {
                $class = self::$classes[$resp['object']];
            } else {
                $class = 'RpayLite\\RpayLiteObject';
            }
            if (isset($resp['items'])) {
                $resp['items'] = self::objectize('item', $resp['items']);
            }
            return $class::constructFrom($resp, $opts);
        }
        // In case of non-array object, return the value as is.
        return $resp;
    }