Refactoring: refactor update_roles to exclude duplication.