Added Comparable.compareTo, so that we can reorder arrays with ids being
mixed up due to to async insert