class OfflineObjectStore implements ParseObjectStore<T> {

  @Override
  public Task<T> getAsync() {
    // We need to set `ignoreACLs` since we can't use ACLs without the current user.
    ParseQuery<T> query = ParseQuery.<T>getQuery(className)
        .fromPin(pinName)
        .ignoreACLs();
    return query.findInBackground().onSuccessTask(new Continuation<List<T>, Task<T>>() {
      @Override
      public Task<T> then(Task<List<T>> task) throws Exception {
        List<T> results = task.getResult();
        if (results != null) {
          if (results.size() == 1) {
            return Task.forResult(results.get(0));
          } else {
            return ParseObject.unpinAllInBackground(pinName).cast();
          }
        }
        return Task.forResult(null);
      }
    }).onSuccessTask(new Continuation<T, Task<T>>() {
      @Override
      public Task<T> then(Task<T> task) throws Exception {
        T ldsObject = task.getResult();
        if (ldsObject != null) {
          return task;
        }

        return migrate(legacy, OfflineObjectStore.this).cast();
      }
    });
  }

  public  OfflineObjectStore(Class<T> clazz, String pinName, ParseObjectStore<T> legacy);
  public  OfflineObjectStore(String className, String pinName, ParseObjectStore<T> legacy);

}