private function traverseObject($obj, $keys)
    {
        if (empty($keys)) {
            return $obj;
        }
        $key = current($keys);

        if (is_array($obj) && isset($obj[$key])) {
            return $this->traverseObject($obj[$key], array_slice($keys, 1));
        } else if (is_object($obj) && isset($obj->{$key})) {
            return $this->traverseObject($obj->{$key}, array_slice($keys, 1));
        } else {
            return null;
        }
    }