db transactions back and forth