@Override
    public RegisteredService save(final RegisteredService registeredService, final boolean publishEvent) {
        return lock.tryLock(() -> {
            val clientInfo = ClientInfoHolder.getClientInfo();
            publishEvent(new CasRegisteredServicePreSaveEvent(this, registeredService, clientInfo));
            val savedService = configurationContext.getServiceRegistry().save(registeredService);
            cacheRegisteredService(savedService);
            saveInternal(registeredService);

            if (publishEvent) {
                publishEvent(new CasRegisteredServiceSavedEvent(this, savedService, clientInfo));
            }
            return savedService;
        });
    }
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