Generalize bulk_operations logic
LMS-11366
Merge pull request #5149 from edx/mongo/bulk_operation

Generalize bulk_operations logic