protected int deleteChildren(final TicketGrantingTicket ticket) {
        val count = new AtomicLong(0);
        val services = ticket.getServices();
        if (services != null && !services.isEmpty()) {
            services.keySet()
                .stream()
                .map(this::getTicket)
                .filter(Objects::nonNull)
                .forEach(serviceTicket -> {
                    val deleteCount = deleteSingleTicket(serviceTicket);
                    if (deleteCount > 0) {
                        LOGGER.debug("Removed ticket [{}]", serviceTicket.getId());
                        count.getAndAdd(deleteCount);
                    } else {
                        LOGGER.debug("Unable to remove ticket [{}]", serviceTicket.getId());
                    }
                });
        }
        return count.intValue();
    }
Delete ticket-granting ticket's service tickets.

@param ticket the ticket
@return the count of tickets that were removed including child tickets and zero if the ticket was not deleted
core/cas-server-core-tickets-api/src/main/java/org/apereo/cas/ticket/registry/AbstractTicketRegistry.java