protected function unassignUserFromUserGroups(User $user, array $userGroups)
    {
        $existingUserGroups = $this->userService->loadUserGroupsOfUser($user);
        foreach ($existingUserGroups as $existingUserGroup) {
            if (!array_key_exists($existingUserGroup->id, $userGroups)) {
                $this->userService->unAssignUserFromUserGroup($user, $existingUserGroup);
            }
        }
    }