protected function prevent_writers_from_sharing_file(\repository_googledocs\rest $client, $fileid) {
        // We don't want anyone but Moodle to change the sharing settings.
        $params = [
            'fileid' => $fileid
        ];
        $update = [
            'writersCanShare' => false
        ];
        $response = $client->call('update', $params, json_encode($update));
        if (empty($response->id)) {
            $details = 'Cannot prevent writers from sharing document: ' . $fileid;
            throw new repository_exception('errorwhilecommunicatingwith', 'repository', '', $details);
        }
        return true;
    }