Refactored name null check and added Role principal.