finished generalizing BSONWriter for Entities