/**
   * Remove an offline region from the database and perform any resources evictions necessary as a
   * result.
   *
   * <p>Eviction works by removing the least-recently requested resources not also required by other
   * regions, until the database shrinks below a certain size.
   *
   * <p>When the operation is complete or encounters an error, the given callback will be executed
   * on the main thread.
   *
   * <p>After you call this method, you may not call any additional methods on this object.
   *
   * @param callback the callback to be invoked
   */
  public void delete(@NonNull final OfflineRegionDeleteCallback callback) {
    deleteOfflineRegion(
        new OfflineRegionDeleteCallback() {
          @Override
          public void onDelete() {
            getHandler()
                .post(
                    new Runnable() {
                      @Override
                      public void run() {
                        callback.onDelete();
                        OfflineRegion.this.finalize();
                      }
                    });
          }

          @Override
          public void onError(final String error) {
            getHandler()
                .post(
                    new Runnable() {
                      @Override
                      public void run() {
                        callback.onError(error);
                      }
                    });
          }
        });
  }