private void removeRemoteIndexingInterceptorFromConfig(Configuration cfg) {
    ConfigurationBuilder builder = new ConfigurationBuilder();
    CustomInterceptorsConfigurationBuilder customInterceptorsBuilder = builder.customInterceptors();

    for (InterceptorConfiguration interceptorConfig : cfg.customInterceptors().interceptors()) {
      if (!(interceptorConfig.asyncInterceptor() instanceof RemoteValueWrapperInterceptor)) {
        customInterceptorsBuilder.addInterceptor().read(interceptorConfig);
      }
    }

    cfg.customInterceptors().interceptors(builder.build().customInterceptors().interceptors());
  }
  private void removeQueryInterceptorFromConfiguration(Configuration cfg) {

    ConfigurationBuilder builder = new ConfigurationBuilder();
    CustomInterceptorsConfigurationBuilder customInterceptorsBuilder = builder.customInterceptors();

    for (InterceptorConfiguration interceptorConfig : cfg.customInterceptors().interceptors()) {
      if (!(interceptorConfig.interceptor() instanceof QueryInterceptor)) {
        customInterceptorsBuilder.addInterceptor().read(interceptorConfig);
      }
    }

    cfg.customInterceptors().interceptors(builder.build().customInterceptors().interceptors());
  }