private function revokeMembership($user)
    {
        try {

            foreach($user->membershipList as $group) {
                if ($group->resync_on_login) {
                    $user->membershipList()->detach($group);
                }
            }

        } catch (\Exception $ex) {
            Log::error('Exception revoking local group membership for user: ' . $user->username . ', Exception message: ' . $ex->getMessage());
            Log::error($ex->getTraceAsString());
        }

    }