Refactor updating of permissions