public static function parseObjectToArray($object) {
        $array = array();
        if (is_object($object))
            $array = get_object_vars($object);
        elseif (is_array($object)) {
            foreach ($object as $k => &$value)
                $array[$k] = self::parseObjectToArray($value);
        } else
            $array = $object;

        return $array;
    }