@Override
    public void save(final Supplier<RegisteredService> supplier,
                     final Consumer<RegisteredService> andThenConsume,
                     final long countExclusive) {
        configurationContext.getServiceRegistry().save(() -> {
            val registeredService = supplier.get();
            val clientInfo = ClientInfoHolder.getClientInfo();
            if (registeredService != null) {
                publishEvent(new CasRegisteredServicePreSaveEvent(this, registeredService, clientInfo));
                cacheRegisteredService(registeredService);
                saveInternal(registeredService);
                publishEvent(new CasRegisteredServiceSavedEvent(this, registeredService, clientInfo));
                return registeredService;
            }
            return null;
        }, andThenConsume, countExclusive);
    }
This is {@link AbstractServicesManager}.

@author Misagh Moayyed
@since 5.2.0
core/cas-server-core-services-registry/src/main/java/org/apereo/cas/services/mgmt/AbstractServicesManager.java