/// <summary>
    /// Run the code example.
    /// </summary>
    /// <param name="user">The DFP user object running the code example.</param>
    public override void Run(DfpUser user) {
      // Get the ProductService.
      ProductService productService =
          (ProductService) user.GetService(DfpService.v201411.ProductService);

      // Create a statement to get all products.
      StatementBuilder statementBuilder = new StatementBuilder()
          .OrderBy("id ASC")
          .Limit(StatementBuilder.SUGGESTED_PAGE_LIMIT);

      // Set default for page.
      ProductPage page = new ProductPage();

      try {
        do {
          // Get products by statement.
          page = productService.getProductsByStatement(statementBuilder.ToStatement());

          if (page.results != null && page.results.Length > 0) {
            int i = page.startIndex;
            foreach (Product product in page.results) {
              Console.WriteLine("{0}) Product with ID = '{1}' and name '{2}' was found.",
                  i++, product.id, product.name);
            }
          }

          statementBuilder.IncreaseOffsetBy(StatementBuilder.SUGGESTED_PAGE_LIMIT);
        } while (statementBuilder.GetOffset() < page.totalResultSetSize);

        Console.WriteLine("Number of results found: {0}", page.totalResultSetSize);
      } catch (Exception ex) {
        Console.WriteLine("Failed to get all products. Exception says \"{0}\"",
            ex.Message);
      }
    }
        /// <summary>
        /// Run the code example.
        /// </summary>
        /// <param name="user">The DFP user object running the code example.</param>
        public override void Run(DfpUser user)
        {
            // Get the ProductService.
              ProductService productService =
              (ProductService) user.GetService(DfpService.v201411.ProductService);

              // Set the ID of the product template to filter products by.
              long productTemplateId = long.Parse(_T("INSERT_PRODUCT_TEMPLATE_ID_HERE"));

              // Create a statement to only select products that were created from a specific
              // product template.
              StatementBuilder statementBuilder = new StatementBuilder()
              .Where("WHERE productTemplateId = :productTemplateId")
              .OrderBy("name ASC")
              .Limit(StatementBuilder.SUGGESTED_PAGE_LIMIT)
              .AddValue("productTemplateId", productTemplateId);

              // Set default for page.
              ProductPage page = new ProductPage();

              try {
            do {
              // Get products by statement.
              page = productService.getProductsByStatement(statementBuilder.ToStatement());

              if (page.results != null && page.results.Length > 0) {
            int i = page.startIndex;
            foreach (Product product in page.results) {
              Console.WriteLine("{0}) Product with ID = '{1}' and name '{2}' was found.",
                  i++, product.id, product.name);
            }
              }
              statementBuilder.IncreaseOffsetBy(StatementBuilder.SUGGESTED_PAGE_LIMIT);
            } while(statementBuilder.GetOffset() < page.totalResultSetSize);
            Console.WriteLine("Number of results found: {0}", page.totalResultSetSize);
              } catch (Exception e) {
            Console.WriteLine("Failed to get products. Exception says \"{0}\"",
            e.Message);
              }
        }