more granular db commits to avoid db locking