update save function in db to add unique insert