private static function restrictFeedItemToAdGroup(
        AdWordsServices $adWordsServices,
        AdWordsSession $session,
        FeedItem $feedItem,
        $adGroupId
    ) {
        $feedItemTargetService =
            $adWordsServices->get($session, FeedItemTargetService::class);

        // Create a feed item ad group target.
        $adGroupTarget = new FeedItemAdGroupTarget();
        $adGroupTarget->setFeedId($feedItem->getFeedId());
        $adGroupTarget->setFeedItemId($feedItem->getFeedItemId());
        $adGroupTarget->setAdGroupId($adGroupId);

        // Create a feed item target operation.
        $operation = new FeedItemTargetOperation();
        $operation->setOperator(Operator::ADD);
        $operation->setOperand($adGroupTarget);

        // Add a feed item target on the server and print out some information.
        $result = $feedItemTargetService->mutate([$operation]);
        $addedAdGroupTarget = $result->getValue()[0];
        sprintf(
            'Feed item target for feed ID %s and feed item ID %s '
            . 'was created to restrict serving to ad group ID %s.%s',
            $addedAdGroupTarget->getFeedId(),
            $addedAdGroupTarget->getFeedItemId(),
            $addedAdGroupTarget->getAdGroupId(),
            PHP_EOL
        );
    }