/// <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 ContentService.
              ContentService contentService =
              (ContentService) user.GetService(DfpService.v201302.ContentService);

              // Set defaults for page and filterStatement.
              ContentPage page = new ContentPage();
              Statement filterStatement = new Statement();
              int offset = 0;

              try {
            do {
              // Create a statement to get all content.
              filterStatement.query = "LIMIT 500 OFFSET " + offset.ToString();

              // Get content by statement.
              page = contentService.getContentByStatement(filterStatement);

              if (page.results != null) {
            int i = page.startIndex;
            foreach (Content content in page.results) {
              Console.WriteLine("{0}) Content with ID \"{1}\", name \"{2}\", and status \"{3}\" " +
                  "was found.", i, content.id, content.name, content.status);
              i++;
            }
              }
              offset += 500;
            } while (offset < page.totalResultSetSize);

            Console.WriteLine("Number of results found: " + page.totalResultSetSize);
              } catch (Exception ex) {
            Console.WriteLine("Failed to get all content. 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 ContentService.
              ContentService contentService =
              (ContentService) user.GetService(DfpService.v201302.ContentService);

              // Get the NetworkService.
              NetworkService networkService = (NetworkService) user.GetService(
              DfpService.v201302.NetworkService);

              // Get the CustomTargetingService.
              CustomTargetingService customTargetingService = (CustomTargetingService) user.GetService(
              DfpService.v201302.CustomTargetingService);

              try {
            // Get content browse custom targeting key ID.
            long contentBrowseCustomTargetingKeyId =
            networkService.getCurrentNetwork().contentBrowseCustomTargetingKeyId;

            // Create a statement to select the categories matching the name comedy.
            Statement categoryFilterStatement = new StatementBuilder(
            "WHERE customTargetingKeyId = :contentBrowseCustomTargetingKeyId " +
            " and name = :category LIMIT 1")
            .AddValue("contentBrowseCustomTargetingKeyId", contentBrowseCustomTargetingKeyId)
            .AddValue("category", "comedy").ToStatement();

            // Get categories matching the filter statement.
            CustomTargetingValuePage customTargetingValuePage =
            customTargetingService.getCustomTargetingValuesByStatement(categoryFilterStatement);

            if (customTargetingValuePage.results != null) {
              // Get the custom targeting value ID for the comedy category.
              long categoryCustomTargetingValueId = customTargetingValuePage.results[0].id;

              // Set defaults for page and filterStatement.
              ContentPage page = new ContentPage();
              Statement filterStatement = new Statement();
              int offset = 0;

              do {
            // Create a statement to get all active content.
            filterStatement.query = "WHERE status = 'ACTIVE' LIMIT 500 OFFSET " + offset.ToString();

            // Get content by statement.
            page = contentService.getContentByStatementAndCustomTargetingValue(filterStatement,
                categoryCustomTargetingValueId);

            if (page.results != null) {
              int i = page.startIndex;
              foreach (Content content in page.results) {
                Console.WriteLine("{0})  Content with ID \"{1}\", name \"{2}\", and status " +
                    "\"{3}\" was found.", i, content.id, content.name, content.status);
                i++;
              }
            }
            offset += 500;
              } while (offset < page.totalResultSetSize);

              Console.WriteLine("Number of results found: " + page.totalResultSetSize);
            }
              } catch (Exception ex) {
            Console.WriteLine("Failed to get content by category. Exception says \"{0}\"", ex.Message);
              }
        }