Generalize bulk_operations logic

LMS-11366

@nasthagiri @cpennington please review
Similarly, for clarification, most of the method names below should be renamed from `write` to `operation`.