add some functions to insert/update into db