public function flatten($data, $originalNames = array())
    {
        $ret = array();

        $it = new \RecursiveIteratorIterator(new \RecursiveArrayIterator($data));
        foreach ($it as $name => $value) {
            if (!is_array($value)) {
                if (isset($originalNames[$name])) {
                    $name = $originalNames[$name];
                }

                $ret[$name] = $value;
            }
        }

        return $ret;
    }