Add API support for writting to DB