private static IEnumerable <KeyValuePair <string, string> > ParseArray <T>(object parameterValue)
            {
                var parameterArray = parameterValue as IEnumerable <T>;

                if (parameterArray == null)
                {
                    return(new KeyValuePair <string, string>[] { });
                }

                var innerParseResult = parameterArray.SelectMany(item => ParametersParser.ParseValue(item));

                return(innerParseResult.Select(parsedPair => new KeyValuePair <string, string>(string.Format("[]{0}", parsedPair.Key), parsedPair.Value)));
            }
            private static IEnumerable <KeyValuePair <string, string> > ParseDictionary <T, U>(object parameterValue)
            {
                var parameterDictionary = parameterValue as IDictionary <T, U>;

                if (parameterDictionary == null)
                {
                    return(new KeyValuePair <string, string>[] { });
                }
                var innerParseResult = parameterDictionary.SelectMany(parameterPair =>
                {
                    var key         = parameterPair.Key.ToString();
                    var parsedItems = ParametersParser.ParseValue(parameterPair.Value);
                    return(parsedItems.Select(item => new KeyValuePair <string, string>(string.Format("[{0}]{1}", key, item.Key), item.Value)));
                });

                return(innerParseResult);
            }
            public static IEnumerable <KeyValuePair <string, string> > Parse(HTTP.Parameters parameters)
            {
                if (parameters == null)
                {
                    return(new KeyValuePair <string, string>[] { });
                }

                var parsedParameters = parameters.SelectMany(pair =>
                {
                    var parameterName  = pair.Key;
                    var parameterValue = pair.Value;
                    var parameterPairs = ParametersParser.ParseValue(parameterValue);
                    var resultList     = parameterPairs.Select(innerPair =>
                    {
                        var key    = string.Format("{0}{1}", parameterName, innerPair.Key);
                        var value  = innerPair.Value;
                        var result = new KeyValuePair <string, string>(key, value);
                        return(result);
                    });
                    return(resultList);
                });

                return(parsedParameters);
            }