This can be done by the consolidated `writeBundle` util function