Generalize bulk_operations logic

LMS-11366

@nasthagiri @cpennington please review
Ah. I was thinking that on entrance, it should call clear. In particular, I was worried about `.dirty` being set outside of a bulk transaction, and then still being set when the bulk op is entered.