/// <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 LabelService.
              LabelService labelService =
              (LabelService) user.GetService(DfpService.v201208.LabelService);

              // Create statement text to select active labels.
              String statementText = "WHERE isActive = :isActive LIMIT 500";
              Statement filterStatement = new StatementBuilder("").AddValue("isActive", true).ToStatement();

              // Set defaults for page and offset.
              LabelPage page = new LabelPage();
              int offset = 0;
              List<string> labelIds = new List<string>();

              try {
            do {
              // Create a statement to page through active labels.
              filterStatement.query = statementText + " OFFSET " + offset;

              // Get labels by statement.
              page = labelService.getLabelsByStatement(filterStatement);

              if (page.results != null) {
            int i = page.startIndex;
            foreach (Label label in page.results) {
              Console.WriteLine("{0}) Label with ID '{1}', name '{2}' will be deactivated.",
                  i, label.id, label.name);
              labelIds.Add(label.id.ToString());
              i++;
            }
              }
              offset += 500;
            } while (offset < page.totalResultSetSize);

            Console.WriteLine("Number of labels to be deactivated: " + labelIds.Count);

            if (labelIds.Count > 0) {
              // Modify statement for action.
              filterStatement.query = "WHERE id IN (" + string.Join(", ", labelIds.ToArray()) + ")";

              // Create action.
              DeactivateLabels action = new DeactivateLabels();

              // Perform action.
              UpdateResult result = labelService.performLabelAction(action, filterStatement);

              // Display results.
              if (result != null && result.numChanges > 0) {
            Console.WriteLine("Number of labels deactivated: " + result.numChanges);
              } else {
            Console.WriteLine("No labels were deactivated.");
              }
            }
              } catch (Exception ex) {
            Console.WriteLine("Failed to deactivate labels. 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 LabelService.
              LabelService labelService =
              (LabelService) user.GetService(DfpService.v201208.LabelService);

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

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

              // Get labels by statement.
              page = labelService.getLabelsByStatement(filterStatement);

              if (page.results != null) {
            int i = page.startIndex;
            foreach (Label label in page.results) {
              StringBuilder builder = new StringBuilder();
              foreach (LabelType labelType in label.types) {
                builder.AppendFormat("{0} | ", labelType);
              }

              Console.WriteLine("{0}) Label with ID '{1}', name '{2}' and type '{3}' was found.",
                  i, label.id, label.name, builder.ToString().TrimEnd(' ', '|'));
              i++;
            }
              }
              offset += 500;
            } while (offset < page.totalResultSetSize);
              } catch (Exception ex) {
            Console.WriteLine("Failed to get labels. Exception says \"{0}\"", ex.Message);
              }
        }