/// <summary>
        /// Creates the ad group.
        /// </summary>
        /// <param name="user">The Google Ads user.</param>
        /// <param name="campaignId">The campaign ID.</param>
        /// <returns>The newly created ad group instance.</returns>
        public aw::AdGroup CreateAdGroup(AdWordsUser user, long campaignId)
        {
            // Get the AdGroupService.
            using (aw::AdGroupService adGroupService =
                       (aw::AdGroupService)user.GetService(AdWordsService.v201809.AdGroupService))
            {
                // Create the ad group.
                aw::AdGroup adGroup = new aw::AdGroup
                {
                    name = string.Format("Earth to Mars Cruises #{0}",
                                         ExampleUtilities.GetRandomString()),
                    status     = aw::AdGroupStatus.ENABLED,
                    campaignId = campaignId,

                    // Set the ad group bids.
                    biddingStrategyConfiguration = new aw::BiddingStrategyConfiguration()
                    {
                        bids = new aw::Bids[]
                        {
                            new aw::CpcBid
                            {
                                bid = new aw::Money
                                {
                                    microAmount = 10000000
                                }
                            }
                        }
                    },

                    // Optional: Set the rotation mode.
                    adGroupAdRotationMode = new aw::AdGroupAdRotationMode
                    {
                        adRotationMode = aw::AdRotationMode.OPTIMIZE
                    }
                };

                // Create the operation.
                aw::AdGroupOperation operation = new aw::AdGroupOperation
                {
                    @operator = aw::Operator.ADD,
                    operand   = adGroup
                };

                // Create the ad group.
                aw::AdGroupReturnValue retVal = adGroupService.mutate(
                    new aw::AdGroupOperation[] { operation });

                // Retrieve the newly created ad group.
                aw::AdGroup newAdGroup = retVal.value[0];

                // Display the results.
                Console.WriteLine($"Ad Group with ID={newAdGroup.id} and name=" +
                                  $"'{newAdGroup.name}' was created.");

                // Return the newly created ad group.
                return(newAdGroup);
            }
        }
        /// <summary>
        /// Runs the code example.
        /// </summary>
        /// <param name="user">The Google Ads user.</param>
        public void Run(AdWordsUser user)
        {
            aw::Budget   budget   = CreateBudget(user);
            aw::Campaign campaign = CreateCampaign(user, budget.budgetId);
            aw::AdGroup  adGroup  = CreateAdGroup(user, campaign.id);

            aw::AdGroupAd[]        adGroupAds      = CreateTextAds(user, adGroup.id);
            aw::AdGroupCriterion[] adGroupCriteria = CreateKeywords(user, adGroup.id,
                                                                    KEYWORDS_TO_ADD);
        }
        /// <summary>
        /// Runs the code example.
        /// </summary>
        /// <param name="user">The Google Ads user.</param>
        /// <param name="client">The Google Ads client.</param>
        public void Run(AdWordsUser user, GoogleAdsClient client)
        {
            // Note: The IDs returned for various entities by both APIs are the same, and can
            // be used interchangeably.
            long customerId = long.Parse((user.Config as AdWordsAppConfig).ClientCustomerId);

            gagvr::CampaignBudget budget   = CreateBudget(client, customerId);
            gagvr::Campaign       campaign = CreateCampaign(client, customerId, budget.Id.Value);
            aw::AdGroup           adGroup  = CreateAdGroup(user, campaign.Id.Value);

            aw::AdGroupAd[]        adGroupAds      = CreateTextAds(user, adGroup.id);
            aw::AdGroupCriterion[] adGroupCriteria = CreateKeywords(user, adGroup.id,
                                                                    KEYWORDS_TO_ADD);
        }