update existing entry if exists; remove entry if no scopes