default Long save(final Supplier<RegisteredService> supplier,
                      final Consumer<RegisteredService> andThenConsume,
                      final long countExclusive) {
        return LongStream.range(0, countExclusive)
            .mapToObj(count -> supplier.get())
            .filter(Objects::nonNull)
            .map(this::save)
            .peek(andThenConsume)
            .count();
    }
Persist the service in the data store.

@param supplier       the supplier
@param andThenConsume the and then consume
@param countExclusive the count exclusive
@return the count of saved services
api/cas-server-core-api-services/src/main/java/org/apereo/cas/services/ServiceRegistry.java