class UsageUpdateHandler implements ResourceUpdateHandler {

    void processInternal(final ChangeEvent event) {
        LOG.debug("Processing event: {}", event);

        final ListResult<Integration> integrationsResult = dataManager.fetchAll(Integration.class);

        final List<Integration> integrations = integrationsResult.getItems();

        updateUsageFor(Connection.class, integrations, Integration::getConnectionIds, Functions.compose(Optional::get, Connection::getId),
            UsageUpdateHandler::withUpdatedUsage);

        updateUsageFor(Extension.class, integrations, Integration::getExtensionIds, Extension::getExtensionId,
            UsageUpdateHandler::withUpdatedUsage);
    }

    public  UsageUpdateHandler(final DataManager dataManager);

}