/// <summary>
        /// Returns an expression for the Average method call which takes lambda expression as a property selctor e.g. q => q.Average(x => x.Balance) <![CDATA[ Expression<Func<IQueryable<Account>, double>> averageExpression ]]>
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="property"></param>
        /// <returns></returns>
        public static LambdaExpression BuildAverageExpression <T>(this string property) where T : class
        {
            if (property == null)
            {
                return(null);
            }

            ParameterExpression  param = Expression.Parameter(typeof(IQueryable <T>), "q");
            MethodCallExpression mce   = param.GetAverageMethodCall(property);
            Type delegateType          = typeof(Func <,>).MakeGenericType(new Type[] { typeof(IQueryable <T>), typeof(T).GetMemberInfoFromFullName(property).GetMemberType() });

            return(Expression.Lambda(delegateType, mce, param));
        }