protected function filterNestedEmptyGroups(AclPresenceInterface $presence)
    {
        if ($presence['type'] !== AclPresenceType::GROUP) {
            return 1;
        }

        $permissions = $presence->permissions();

        if ( ! $permissions) {
            return 0;
        }

        if (is_string($permissions)) {
            return 1;
        }

        return count($permissions);
    }