This makes me nervous as it will be potentially modifying a bunch of records without any transactional safety. As far as I know the ORM doesn't offer transactions but locks are available. Alternatively could the relevant records all be updated at once through SQL?