protected function add_writer_to_file(\repository_googledocs\rest $client, $fileid, $email) {
        $updateeditor = [
            'emailAddress' => $email,
            'role' => 'writer',
            'type' => 'user'
        ];
        $params = ['fileid' => $fileid, 'sendNotificationEmail' => 'false'];
        $response = $client->call('create_permission', $params, json_encode($updateeditor));
        if (empty($response->id)) {
            $details = 'Cannot add user ' . $email . ' as a writer for document: ' . $fileid;
            throw new repository_exception('errorwhilecommunicatingwith', 'repository', '', $details);
        }
        return true;
    }