Split write operations into a specified number of children operations

Not the prettiest bit of code but I need this for the Bulk API:
If a write operation is too large to send, I'll want to split it into multiple children operations to be sent individually instead.

You beat me to it! :)