Implement ObjectId encoder