public static OutputUnmarshaller GetInstance()
        {
            if (instance == null)
            {
                instance = new OutputUnmarshaller();
            }

            return(instance);
        }
        public Stack Unmarshall(UnmarshallerContext context)
        {
            Stack stack         = new Stack();
            int   originalDepth = context.CurrentDepth;
            int   targetDepth   = originalDepth + 1;

            if (context.IsStartOfDocument)
            {
                targetDepth += 2;
            }

            while (context.Read())
            {
                if (context.IsStartElement || context.IsAttribute)
                {
                    if (context.TestExpression("StackId", targetDepth))
                    {
                        stack.StackId = StringUnmarshaller.GetInstance().Unmarshall(context);

                        continue;
                    }
                    if (context.TestExpression("StackName", targetDepth))
                    {
                        stack.StackName = StringUnmarshaller.GetInstance().Unmarshall(context);

                        continue;
                    }
                    if (context.TestExpression("Description", targetDepth))
                    {
                        stack.Description = StringUnmarshaller.GetInstance().Unmarshall(context);

                        continue;
                    }
                    if (context.TestExpression("Parameters/member", targetDepth))
                    {
                        stack.Parameters.Add(ParameterUnmarshaller.GetInstance().Unmarshall(context));

                        continue;
                    }
                    if (context.TestExpression("CreationTime", targetDepth))
                    {
                        stack.CreationTime = DateTimeUnmarshaller.GetInstance().Unmarshall(context);

                        continue;
                    }
                    if (context.TestExpression("StackStatus", targetDepth))
                    {
                        stack.StackStatus = StringUnmarshaller.GetInstance().Unmarshall(context);

                        continue;
                    }
                    if (context.TestExpression("StackStatusReason", targetDepth))
                    {
                        stack.StackStatusReason = StringUnmarshaller.GetInstance().Unmarshall(context);

                        continue;
                    }
                    if (context.TestExpression("DisableRollback", targetDepth))
                    {
                        stack.DisableRollback = BoolUnmarshaller.GetInstance().Unmarshall(context);

                        continue;
                    }
                    if (context.TestExpression("NotificationARNs/member", targetDepth))
                    {
                        stack.NotificationARNs.Add(StringUnmarshaller.GetInstance().Unmarshall(context));

                        continue;
                    }
                    if (context.TestExpression("TimeoutInMinutes", targetDepth))
                    {
                        stack.TimeoutInMinutes = IntUnmarshaller.GetInstance().Unmarshall(context);

                        continue;
                    }
                    if (context.TestExpression("Outputs/member", targetDepth))
                    {
                        stack.Outputs.Add(OutputUnmarshaller.GetInstance().Unmarshall(context));

                        continue;
                    }
                }
                else if (context.IsEndElement && context.CurrentDepth < originalDepth)
                {
                    return(stack);
                }
            }

            return(stack);
        }