private TResult ApplyScalarMethods <TResult, TDocument>(SolrCompositeQuery compositeQuery, SolrSearchResults <TDocument> processedResults, SolrQueryResults <Dictionary <string, object> > results)
        {
            var method = compositeQuery.Methods.First();

            object result;

            switch (method.MethodType)
            {
            case QueryMethodType.All:
                result = true;
                break;

            case QueryMethodType.Any:
                result = processedResults.Any();
                break;

            case QueryMethodType.Count:
                result = processedResults.Count();
                break;

            case QueryMethodType.ElementAt:
                if (((ElementAtMethod)method).AllowDefaultValue)
                {
                    result = processedResults.ElementAtOrDefault(((ElementAtMethod)method).Index);
                }
                else
                {
                    result = processedResults.ElementAt(((ElementAtMethod)method).Index);
                }

                break;

            case QueryMethodType.First:
                if (((FirstMethod)method).AllowDefaultValue)
                {
                    result = processedResults.FirstOrDefault();
                }
                else
                {
                    result = processedResults.First();
                }

                break;

            case QueryMethodType.Last:
                if (((LastMethod)method).AllowDefaultValue)
                {
                    result = processedResults.LastOrDefault();
                }
                else
                {
                    result = processedResults.Last();
                }

                break;

            case QueryMethodType.Single:
                if (((SingleMethod)method).AllowDefaultValue)
                {
                    result = processedResults.SingleOrDefault();
                }
                else
                {
                    result = processedResults.Single();
                }

                break;

            case QueryMethodType.GetResults:
                var resultList = processedResults.GetSearchHits();
                var facets     = this.FormatFacetResults(processedResults.GetFacets(), compositeQuery.FacetQueries);
                result = ReflectionUtility.CreateInstance(typeof(TResult), resultList, processedResults.NumberFound, facets);     // Create instance of SearchResults<TDocument>
                break;


            case QueryMethodType.GetFacets:
                result = this.FormatFacetResults(processedResults.GetFacets(), compositeQuery.FacetQueries);
                break;

            default:
                throw new InvalidOperationException("Invalid query method");
            }

            return((TResult)System.Convert.ChangeType(result, typeof(TResult)));
        }