Unify the serialization checks for Bson/Json by introducing isXXXSerializable helper templates.

Also added static asserts in unit test blocks to verify their correctness.