Current doc is now passed (and returned) to the custom save methods.