private void CheckQueryableType(Type queryableType)
        {
            LinqUtility.CheckTypeIsAssignableFrom("queryableType", queryableType, typeof(IQueryable));

            var queryableTypeInfo = queryableType.GetTypeInfo();

            if (!queryableTypeInfo.IsGenericTypeDefinition)
            {
                var message = string.Format(
                    "Expected the generic type definition of an implementation of IQueryable<T>, but was '{0}'.",
                    queryableType);
                throw new ArgumentException(message, "queryableType");
            }
            var genericArgumentCount = queryableTypeInfo.GenericTypeParameters.Length;

            if (genericArgumentCount != 1)
            {
                var message = string.Format(
                    "Expected the generic type definition of an implementation of IQueryable<T> with exactly one type argument, but found {0} arguments on '{1}.",
                    genericArgumentCount,
                    queryableType);
                throw new ArgumentException(message, "queryableType");
            }
        }