It could be performance issue in the future. I propose to move out db().commit() from the loop