private static CodeMemberMethod CreateSetTemplate()
        {
            var method = new CodeMemberMethod
            {
                Name       = "SetTemplate",
                Attributes = MemberAttributes.Public | MemberAttributes.Static
            };

            method.Parameters.Add(
                new CodeParameterDeclarationExpression(
                    new CodeTypeReference("AlexaRequestInformation<Alexa.NET.Request.APLSkillRequest>"),
                    CodeConstants.RequestVariableName));
            method.Parameters.Add(new CodeParameterDeclarationExpression(
                                      new CodeTypeReference(typeof(string)), "templateName"));

            method.Statements.Add(CodeGeneration_Instructions.SetVariable("scene_template", new CodeVariableReferenceExpression("templateName"), false));

            return(method);
        }
        private static CodeMemberMethod CreateSetDataProperty()
        {
            var method = new CodeMemberMethod
            {
                Name       = "SetDataProperty",
                Attributes = MemberAttributes.Public | MemberAttributes.Static
            };

            method.Parameters.Add(
                new CodeParameterDeclarationExpression(
                    new CodeTypeReference("AlexaRequestInformation<Alexa.NET.Request.APLSkillRequest>"),
                    CodeConstants.RequestVariableName));
            method.Parameters.Add(new CodeParameterDeclarationExpression(
                                      new CodeTypeReference(typeof(string)), "property"));
            method.Parameters.Add(new CodeParameterDeclarationExpression(
                                      new CodeTypeReference(typeof(string)), "value"));

            method.Statements.Add(CodeGeneration_Instructions.SetVariable(
                                      new CodeBinaryOperatorExpression(new CodePrimitiveExpression("scene_"), CodeBinaryOperatorType.Add, new CodeVariableReferenceExpression("property")), new CodeVariableReferenceExpression("value")));

            return(method);
        }
        private static CodeMemberMethod CreateGenerateSpeech()
        {
            var method = new CodeMemberMethod
            {
                Name       = "GenerateSpeech",
                Attributes = MemberAttributes.Static,
                ReturnType = new CodeTypeReference("SkillResponse")
            };

            method.Parameters.Add(
                new CodeParameterDeclarationExpression(
                    new CodeTypeReference("AlexaRequestInformation<Alexa.NET.Request.APLSkillRequest>"),
                    CodeConstants.RequestVariableName));

            var items  = new CodePropertyReferenceExpression(new CodeVariableReferenceExpression(CodeConstants.RequestVariableName), "Items");
            var speech = new CodePrimitiveExpression("speech");

            method.Statements.Add(new CodeVariableDeclarationStatement(typeof(string), "fullSpeech", new CodePrimitiveExpression(null)));
            method.Statements.Add(new CodeConditionStatement(
                                      new CodeMethodInvokeExpression(new CodePropertyReferenceExpression(CodeConstants.RequestVariableRef, "Items"), "ContainsKey", speech),
                                      new CodeAssignStatement(
                                          new CodeVariableReferenceExpression("fullSpeech"),
                                          new CodeMethodInvokeExpression(
                                              new CodeTypeReferenceExpression(typeof(string)),
                                              "Concat",
                                              new CodeMethodInvokeExpression(
                                                  new CodeCastExpression("List<string>", new CodeIndexerExpression(items, speech)),
                                                  "ToArray")))));

            method.Statements.Add(CodeGeneration_Instructions.SetVariable(
                                      new CodePrimitiveExpression("scene_lastSpeech"), new CodeVariableReferenceExpression("fullSpeech")));


            method.Statements.Add(new CodeVariableDeclarationStatement(
                                      new CodeTypeReference("var"),
                                      "speech",
                                      new CodeMethodInvokeExpression(_refOutput, "CreateOutput", new CodeVariableReferenceExpression("fullSpeech"))
                                      ));

            method.Statements.Add(new CodeVariableDeclarationStatement(new CodeTypeReference("SkillResponse"), "response"));
            var checkForCandidates = new CodeConditionStatement(new CodeMethodInvokeExpression(new CodeTypeReferenceExpression("Navigation"),
                                                                                               "HasCandidates", new CodeVariableReferenceExpression(CodeConstants.RequestVariableName)));

            checkForCandidates.TrueStatements.Add(new CodeVariableDeclarationStatement(
                                                      new CodeTypeReference("var"),
                                                      "reprompt",
                                                      new CodeMethodInvokeExpression(_refOutput, "CreateOutput",
                                                                                     new CodeMethodInvokeExpression(
                                                                                         new CodeVariableReferenceExpression(CodeConstants.RequestVariableName), "GetValue<string>",
                                                                                         new CodePrimitiveExpression("scene_reprompt")))));
            checkForCandidates.TrueStatements.Add(new CodeAssignStatement(new CodeVariableReferenceExpression("response"),
                                                                          new CodeMethodInvokeExpression(new CodeTypeReferenceExpression("ResponseBuilder"), "Ask", new CodeVariableReferenceExpression("speech"), new CodeSnippetExpression("new Reprompt{OutputSpeech=reprompt == null ? speech : reprompt}"))));
            checkForCandidates.FalseStatements.Add(new CodeAssignStatement(new CodeVariableReferenceExpression("response"),
                                                                           new CodeMethodInvokeExpression(new CodeTypeReferenceExpression("ResponseBuilder"), "Tell", new CodeVariableReferenceExpression("speech"))));

            method.Statements.Add(checkForCandidates);
            //response.SessionAttributes = request.State.Session.Attributes;
            method.Statements.Add(new CodeAssignStatement(
                                      new CodePropertyReferenceExpression(new CodeVariableReferenceExpression("response"),
                                                                          "SessionAttributes"),
                                      new CodePropertyReferenceExpression(new CodePropertyReferenceExpression(new CodePropertyReferenceExpression(new CodeVariableReferenceExpression("request"), "State"), "Session"), "Attributes")));
            method.Statements.Add(new CodeMethodReturnStatement(new CodeVariableReferenceExpression("response")));

            return(method);
        }