public static SelectParameterResult TryCast(BindingData bindingData,
                                                    string key, bool checkFileName)
        {
            var parameterRequiringValidation = bindingData.parameterRequiringValidation;
            var queryResult = bindingData.fetchQueryParam(parameterRequiringValidation,
                                                          (v) =>
            {
                return(SelectParameterResult.Query(v, key, parameterRequiringValidation));
            },
                                                          (whyQuery) => SelectParameterResult.FailureQuery(whyQuery, key, parameterRequiringValidation));

            if (queryResult.valid)
            {
                return(queryResult);
            }

            if (!checkFileName)
            {
                return(queryResult);
            }

            return(bindingData.fetchDefaultParam(parameterRequiringValidation,
                                                 (v) =>
            {
                return SelectParameterResult.File(v, key, parameterRequiringValidation);
            },
                                                 (whyQuery) =>
            {
                return queryResult;
            }));
        }
        public virtual SelectParameterResult TryCast(BindingData bindingData)
        {
            var parameterRequiringValidation = bindingData.parameterRequiringValidation;
            var key        = GetKey(parameterRequiringValidation);
            var fileResult = bindingData.fetchDefaultParam(parameterRequiringValidation,
                                                           (v) =>
            {
                return(SelectParameterResult.File(v, key, parameterRequiringValidation));
            },
                                                           (whyQuery) => SelectParameterResult.FailureFile(
                                                               $"Could not create value in file.",
                                                               key, parameterRequiringValidation));

            if (fileResult.valid)
            {
                return(fileResult);
            }

            var queryResult = bindingData.fetchQueryParam(parameterRequiringValidation,
                                                          (v) =>
            {
                if (fileResult.valid)
                {
                    fileResult.fromQuery = true;
                    return(fileResult);
                }
                return(SelectParameterResult.Query(v, key, parameterRequiringValidation));
            },
                                                          (whyQuery) =>
            {
                if (fileResult.valid)
                {
                    return(fileResult);
                }
                return(SelectParameterResult.FailureQuery(whyQuery, key, parameterRequiringValidation));
            });

            if (queryResult.valid)
            {
                return(queryResult);
            }

            return(bindingData.fetchBodyParam(parameterRequiringValidation,
                                              (v) =>
            {
                return SelectParameterResult.Body(v, key, parameterRequiringValidation);
            },
                                              (whyQuery) =>
            {
                if (queryResult.valid)
                {
                    return queryResult;
                }
                return SelectParameterResult.FailureBody(whyQuery, key, parameterRequiringValidation);
            }));
        }