Convert static BSON encode/decode methods to global functions