Add support for upsert.
Delete unused method.
JSON I/O improvements.