Update the way the api is generated. Move write_tags into model.