private object InvokeConstructor(NewExpression expression, object[] args, out int argumentCount)
        {
            object valueToSet;
            int    nestedArgumentCount;

            argumentCount = 0;
            ArrayList argList = new ArrayList();

            int i = 0;

            foreach (var arg in expression.Arguments)
            {
                switch (arg.NodeType)
                {
                case ExpressionType.New:
                    valueToSet = InvokeConstructor((NewExpression)arg, args.Skip(i).ToArray(), out nestedArgumentCount);
                    i         += nestedArgumentCount;
                    break;

                case ExpressionType.MemberInit:
                    valueToSet = InvokeMemberInitExpression((MemberInitExpression)arg,
                                                            args.Skip(i).ToArray(), out nestedArgumentCount);
                    i += nestedArgumentCount;
                    break;

                default:
                    valueToSet = LinqUtil.ChangeType(args[i], arg.Type);
                    i++;
                    break;
                }
                argList.Add(valueToSet);
            }

            argumentCount = i;
            return(expression.Constructor.Invoke(argList.ToArray()));
        }