db transactions moved to model