public PutPipelineDefinitionResult Unmarshall(JsonUnmarshallerContext context)
        {
            PutPipelineDefinitionResult putPipelineDefinitionResult = new PutPipelineDefinitionResult();

            putPipelineDefinitionResult.ValidationErrors   = null;
            putPipelineDefinitionResult.ValidationWarnings = null;

            int originalDepth = context.CurrentDepth;
            int targetDepth   = originalDepth + 1;

            while (context.Read())
            {
                if ((context.IsKey) && (context.CurrentDepth == targetDepth))
                {
                    context.Read();
                    context.Read();

                    if (context.TestExpression("ValidationErrors", targetDepth))
                    {
                        putPipelineDefinitionResult.ValidationErrors = new List <ValidationError>();
                        ValidationErrorUnmarshaller unmarshaller = ValidationErrorUnmarshaller.GetInstance();
                        while (context.Read())
                        {
                            if ((context.IsArrayElement) && (context.CurrentDepth == targetDepth))
                            {
                                putPipelineDefinitionResult.ValidationErrors.Add(unmarshaller.Unmarshall(context));
                            }
                            else if (context.IsEndArray)
                            {
                                break;
                            }
                        }
                        continue;
                    }

                    if (context.TestExpression("ValidationWarnings", targetDepth))
                    {
                        putPipelineDefinitionResult.ValidationWarnings = new List <ValidationWarning>();
                        ValidationWarningUnmarshaller unmarshaller = ValidationWarningUnmarshaller.GetInstance();
                        while (context.Read())
                        {
                            if ((context.IsArrayElement) && (context.CurrentDepth == targetDepth))
                            {
                                putPipelineDefinitionResult.ValidationWarnings.Add(unmarshaller.Unmarshall(context));
                            }
                            else if (context.IsEndArray)
                            {
                                break;
                            }
                        }
                        continue;
                    }

                    if (context.TestExpression("Errored", targetDepth))
                    {
                        putPipelineDefinitionResult.Errored = BoolUnmarshaller.GetInstance().Unmarshall(context);
                        continue;
                    }
                }
                else if (context.IsEndElement && context.CurrentDepth <= originalDepth)
                {
                    return(putPipelineDefinitionResult);
                }
            }


            return(putPipelineDefinitionResult);
        }
        private static void UnmarshallResult(JsonUnmarshallerContext context, ValidatePipelineDefinitionResponse response)
        {
            int originalDepth = context.CurrentDepth;
            int targetDepth   = originalDepth + 1;

            while (context.Read())
            {
                if (context.TestExpression("validationErrors", targetDepth))
                {
                    context.Read();
                    response.ValidationErrors = new List <ValidationError>();
                    ValidationErrorUnmarshaller unmarshaller = ValidationErrorUnmarshaller.GetInstance();
                    while (context.Read())
                    {
                        JsonToken token = context.CurrentTokenType;
                        if (token == JsonToken.ArrayStart)
                        {
                            continue;
                        }
                        if (token == JsonToken.ArrayEnd)
                        {
                            break;
                        }
                        response.ValidationErrors.Add(unmarshaller.Unmarshall(context));
                    }
                    continue;
                }

                if (context.TestExpression("validationWarnings", targetDepth))
                {
                    context.Read();
                    response.ValidationWarnings = new List <ValidationWarning>();
                    ValidationWarningUnmarshaller unmarshaller = ValidationWarningUnmarshaller.GetInstance();
                    while (context.Read())
                    {
                        JsonToken token = context.CurrentTokenType;
                        if (token == JsonToken.ArrayStart)
                        {
                            continue;
                        }
                        if (token == JsonToken.ArrayEnd)
                        {
                            break;
                        }
                        response.ValidationWarnings.Add(unmarshaller.Unmarshall(context));
                    }
                    continue;
                }

                if (context.TestExpression("errored", targetDepth))
                {
                    context.Read();
                    response.Errored = BoolUnmarshaller.GetInstance().Unmarshall(context);
                    continue;
                }

                if (context.CurrentDepth <= originalDepth)
                {
                    return;
                }
            }

            return;
        }