private string TemplateIfStatement(If ifStatement, object nestedIfText, bool isNested, ref StringBuilder builder)
        {
            var constraintText = new StringBuilder();
            var elseConstraintText = new StringBuilder();
            var conditionText = string.Empty;

            conditionText = _booleanGenerator.Generate(ifStatement.TargetList, ref builder);
            constraintText = GenerateConstraints(ifStatement.Then.Constraints, constraintText);

            if (ifStatement.Else != null)
            {
                elseConstraintText = GenerateConstraints(ifStatement.Else.Constraints, elseConstraintText);
            }

            var templateParams = new Dictionary<string, object>
                                     {
                                         {"condition", conditionText},
                                         {"constraints", constraintText.ToString()},
                                         {"nestedIf", nestedIfText},
                                         {"hasNestedIf", nestedIfText != null},
                                         {"isNested", isNested},
                                         {"elseConstraints", elseConstraintText}
                                     };
            return templateParams.AsNVelocityTemplate(TemplateEnum.IfElseStatement);
        }
 public string GenerateRecursive(If ifStatement, ref StringBuilder builder)
 {
     object nestedIf = null;
     if (ifStatement.Else == null)
     {
         return TemplateIfStatement(ifStatement, null, false, ref builder);
     }
     if (ifStatement.Else != null)
     {
         if (ifStatement.Else.If != null)
         {
             nestedIf = GenerateRecursive(ifStatement.Else.If, ref builder);
         }
         return TemplateIfStatement(ifStatement, nestedIf, true, ref builder);
     }
     return string.Empty;
 }