JSONEncoder to encode our models
Fix unseriazable history.