public function getCampaignsAction(
        Request $request,
        FetchAuthTokenInterface $oAuth2Credential,
        AdWordsServices $adWordsServices,
        AdWordsSessionBuilder $adWordsSessionBuilder
    ) {
        if ($request->method() === 'POST') {
            // Always select at least the "Id" field.
            $selectedFields = array_values(
                ['id' => 'Id'] + $request->except(
                    ['_token', 'clientCustomerId', 'entriesPerPage']
                )
            );
            $clientCustomerId = $request->input('clientCustomerId');
            $entriesPerPage = $request->input('entriesPerPage');

            // Construct an API session configured from a properties file and
            // the OAuth2 credentials above.
            $session =
                $adWordsSessionBuilder->fromFile(config('app.adsapi_php_path'))
                    ->withOAuth2Credential($oAuth2Credential)
                    ->withClientCustomerId($clientCustomerId)
                    ->build();

            $request->session()->put('selectedFields', $selectedFields);
            $request->session()->put('entriesPerPage', $entriesPerPage);
            $request->session()->put('session', $session);
        } else {
            $selectedFields = $request->session()->get('selectedFields');
            $entriesPerPage = $request->session()->get('entriesPerPage');
            $session = $request->session()->get('session');
        }

        $pageNo = $request->input('page') ?: 1;
        $collection = self::fetchCampaigns(
            $request,
            $adWordsServices->get($session, CampaignService::class),
            $selectedFields,
            $entriesPerPage,
            $pageNo
        );

        // Create a length aware paginator to supply campaigns for the view,
        // based on the specified number of entries per page.
        $campaigns = new LengthAwarePaginator(
            $collection,
            $request->session()->get('totalNumEntries'),
            $entriesPerPage,
            $pageNo,
            ['path' => url('get-campaigns')]
        );

        return view('campaigns', compact('campaigns', 'selectedFields'));
    }