/// <summary>
        /// Creates a FeedItemOperation that will create a FeedItem with the
        /// specified values and ad group target when sent to
        /// FeedItemService.mutate.
        /// </summary>
        /// <param name="adCustomizerFeed">The ad customizer feed.</param>
        /// <param name="name">The value for the name attribute of the FeedItem.
        /// </param>
        /// <param name="price">The value for the price attribute of the FeedItem.
        /// </param>
        /// <param name="date">The value for the date attribute of the FeedItem.
        /// </param>
        /// <param name="adGroupId">The ID of the ad group to target with the
        /// FeedItem.</param>
        /// <returns>A new FeedItemOperation for adding a FeedItem.</returns>
        private static FeedItemOperation CreateFeedItemAddOperation(AdCustomizerFeed adCustomizerFeed,
        string name, string price, String date, long adGroupId)
        {
            FeedItem feedItem = new FeedItem();
              feedItem.feedId = adCustomizerFeed.feedId;
              List<FeedItemAttributeValue> attributeValues = new List<FeedItemAttributeValue>();

              // FeedAttributes appear in the same order as they were created
              // - Name, Price, Date. See CreateCustomizerFeed method for details.
              FeedItemAttributeValue nameAttributeValue = new FeedItemAttributeValue();
              nameAttributeValue.feedAttributeId = adCustomizerFeed.feedAttributes[0].id;
              nameAttributeValue.stringValue = name;
              attributeValues.Add(nameAttributeValue);

              FeedItemAttributeValue priceAttributeValue = new FeedItemAttributeValue();
              priceAttributeValue.feedAttributeId = adCustomizerFeed.feedAttributes[1].id;
              priceAttributeValue.stringValue = price;
              attributeValues.Add(priceAttributeValue);

              FeedItemAttributeValue dateAttributeValue = new FeedItemAttributeValue();
              dateAttributeValue.feedAttributeId = adCustomizerFeed.feedAttributes[2].id;
              dateAttributeValue.stringValue = date;
              attributeValues.Add(dateAttributeValue);

              feedItem.attributeValues = attributeValues.ToArray();

              feedItem.adGroupTargeting = new FeedItemAdGroupTargeting();
              feedItem.adGroupTargeting.TargetingAdGroupId = adGroupId;

              FeedItemOperation feedItemOperation = new FeedItemOperation();
              feedItemOperation.operand = feedItem;
              feedItemOperation.@operator = Operator.ADD;

              return feedItemOperation;
        }
        private static void createSitelinksFeedItems(
        AdWordsUser user, SitelinksDataHolder siteLinksData)
        {
            // Get the FeedItemService.
              FeedItemService feedItemService =
            (FeedItemService) user.GetService(AdWordsService.v201502.FeedItemService);

              // Create operations to add FeedItems.
              FeedItemOperation home =
              newSitelinkFeedItemAddOperation(siteLinksData,
              "Home", "http://www.example.com");
              FeedItemOperation stores =
              newSitelinkFeedItemAddOperation(siteLinksData,
              "Stores", "http://www.example.com/stores");
              FeedItemOperation onSale =
              newSitelinkFeedItemAddOperation(siteLinksData,
              "On Sale", "http://www.example.com/sale");
              FeedItemOperation support =
              newSitelinkFeedItemAddOperation(siteLinksData,
              "Support", "http://www.example.com/support");
              FeedItemOperation products =
              newSitelinkFeedItemAddOperation(siteLinksData,
              "Products", "http://www.example.com/prods");
              FeedItemOperation aboutUs =
              newSitelinkFeedItemAddOperation(siteLinksData,
              "About Us", "http://www.example.com/about");

              FeedItemOperation[] operations =
              new FeedItemOperation[] {home, stores, onSale, support, products, aboutUs};

              FeedItemReturnValue result = feedItemService.mutate(operations);
              foreach (FeedItem item in result.value) {
            Console.WriteLine("FeedItem with feedItemId {0} was added.", item.feedItemId);
            siteLinksData.FeedItemIds.Add(item.feedItemId);
              }
        }
        private static FeedItemOperation newSitelinkFeedItemAddOperation(
        SitelinksDataHolder sitelinksData, String text, String finalUrl)
        {
            // Create the FeedItemAttributeValues for our text values.
              FeedItemAttributeValue linkTextAttributeValue = new FeedItemAttributeValue();
              linkTextAttributeValue.feedAttributeId = sitelinksData.LinkTextFeedAttributeId;
              linkTextAttributeValue.stringValue = text;
              FeedItemAttributeValue linkFinalUrlAttributeValue = new FeedItemAttributeValue();
              linkFinalUrlAttributeValue.feedAttributeId = sitelinksData.LinkFinalUrlFeedAttributeId;
              linkFinalUrlAttributeValue.stringValues = new string[] { finalUrl };

              // Create the feed item and operation.
              FeedItem item = new FeedItem();
              item.feedId = sitelinksData.FeedId;
              item.attributeValues =
              new FeedItemAttributeValue[] {linkTextAttributeValue, linkFinalUrlAttributeValue};
              FeedItemOperation operation = new FeedItemOperation();
              operation.operand = item;
              operation.@operator = Operator.ADD;
              return operation;
        }
 /// <summary>
 /// Deletes the old feed items for which extension settings have been
 /// created.
 /// </summary>
 /// <param name="user">The user that owns the feed items.</param>
 /// <param name="feedItemIds">IDs of the feed items to be removed.</param>
 /// <param name="feedId">ID of the feed that holds the feed items.</param>
 private void DeleteOldFeedItems(AdWordsUser user, List<long> feedItemIds, long feedId)
 {
     if (feedItemIds.Count == 0) {
     return;
       }
       List<FeedItemOperation> operations = new List<FeedItemOperation>();
       foreach (long feedItemId in feedItemIds) {
     FeedItemOperation operation = new FeedItemOperation() {
       @operator = Operator.REMOVE,
       operand = new FeedItem() {
     feedItemId = feedItemId,
     feedId = feedId
       }
     };
     operations.Add(operation);
       }
       FeedItemService feedItemService = (FeedItemService) user.GetService(
       AdWordsService.v201502.FeedItemService);
       feedItemService.mutate(operations.ToArray());
       return;
 }