private function collectIdentityRolesAndPermissions(RoleService $roleService)
    {
        $identityRoles = $roleService->getIdentityRoles();

        foreach ($identityRoles as $role) {
            $roleName = $role->getName();

            if (!$role instanceof HierarchicalRoleInterface) {
                $this->collectedRoles[] = $roleName;
            } else {
                $iteratorIterator = new RecursiveIteratorIterator(
                    new RecursiveRoleIterator($role->getChildren()),
                    RecursiveIteratorIterator::SELF_FIRST
                );

                foreach ($iteratorIterator as $childRole) {
                    $this->collectedRoles[$roleName][] = $childRole->getName();
                    $this->collectPermissions($childRole);
                }
            }

            $this->collectPermissions($role);
        }
    }