You should first iterate all `$identityRoles` to check if the identity doest not have the role. If not, then iterate again checking recursively.