I think it's better to move this logic inside the get_restricted_instances function since it's returning templates, not sites.