protected function flattenArray(array $values, $previous = '')
    {
        $result = array();
        foreach ($values as $key => $value) {
            if ($previous) {
                $key = $previous.'['.$key.']';
            }
            if (is_array($value)) {
                $result = $result + $this->flattenArray($value, $key);
            } else {
                $result[$key] = $value;
            }
        }

        return $result;
    }