/// <summary>
        /// Returns a list of objects mapped to the values in the parameters or postdata in the order of the matched actions's arguments.
        /// Objects will be parsed into the types declared by the method arguments
        /// </summary>
        /// <param name="action">The controller action that matches the route</param>
        /// <param name="requestContext">The request context</param>
        /// <param name="parameters">A collection of key value pairs</param>
        /// <param name="postData">The data posted by Cef from the browser</param>
        /// <returns></returns>
        public object[] BindParameters(MvcAction action, RequestContext requestContext, object parameters, object postData)
        {
            var methodInfo = action.ActionContext.ActionMethod;
            var arguments  = new List <object>();

            var actionParameters = methodInfo.GetParameters();

            // TODO: Handle case where same parameter appears in the querystring and post data

            if (requestContext.QueryParameters != null)
            {
                // TODO: handle multiple values for one key
                var queryParameters = requestContext.QueryParameters.ToDictionary(x => x.Key, x => (object)x.Value);
                foreach (var parameter in actionParameters.OrderBy(x => x.Position))
                {
                    var boundValue = _modelBinder.GetBoundValue(parameter.ParameterType, parameter.Name, queryParameters);
                    arguments.Add(boundValue);
                }
            }

            if (parameters != null)
            {
                var paramlookup = (IDictionary <string, object>)((IDictionary <string, string>)parameters).ToDictionary(x => x.Key, x => (object)x.Value);


                foreach (var parameter in actionParameters.OrderBy(x => x.Position))
                {
                    var boundValue = _modelBinder.GetBoundValue(parameter.ParameterType, parameter.Name, paramlookup);
                    arguments.Add(boundValue);
                }
            }

            if (postData != null)
            {
                if (actionParameters.Length == 1)
                {
                    switch (postData)
                    {
                    case JsonElement data:
                        arguments.Add(_modelBinder.BindToModel(actionParameters[0].ParameterType, data));
                        break;

                    case ExpandoObject _:
                    case List <ExpandoObject> _:
                    case List <object> _:
                        arguments.Add(_modelBinder.BindToModel(actionParameters[0].ParameterType, postData));
                        break;

                    default:
                        throw new Exception($"Unsupported type: {postData.GetType()}");
                    }
                }
                else
                {
                    throw new Exception("POST with zero or multiple parameters is not supported");
                }
            }


            return(arguments.ToArray());
        }