public static function runExample(
        ServiceFactory $serviceFactory,
        AdManagerSession $session
    ) {
        $networkService = $serviceFactory->createNetworkService($session);

        // Get all networks that you have access to with the current
        // authentication credentials.
        $networks = $networkService->getAllNetworks();

        if (empty($networks)) {
            printf('No accessible networks found.' . PHP_EOL);
            return;
        }

        // Print out some information for each network.
        foreach ($networks as $i => $network) {
            printf(
                "%d) Network with code %d and display name '%s' was found.%s",
                $i,
                $network->getNetworkCode(),
                $network->getDisplayName(),
                PHP_EOL
            );
        }

        printf("Number of results found: %d%s", count($networks), PHP_EOL);
    }