code: public static DBObject serializeFields(ObjectMapper objectMapper, DBObject object) {
          BasicDBObject serialised = null;
          for (String field : object.keySet()) {
              Object value = object.get(field);
              Object serialisedValue = serializeField(objectMapper, value);
              if (value != serialisedValue) {
                  // It's changed
                  if (serialised == null) {
                      // Make a shallow copy of the object
                      serialised = new BasicDBObject();
                      for (String f : object.keySet()) {
                          serialised.put(f, object.get(f));
                      }
                  }
                  serialised.put(field, serialisedValue);
              }
          }
          if (serialised != null) {
              return serialised;
          } else {
              return object;
          }
      }
docs: Serialize the fields of the given object using the given object mapper.  This will convert POJOs to DBObjects
  where necessary.
  
  @param objectMapper The object mapper to use to do the serialization
  @param object       The object to serialize the fields of
  @return The DBObject, safe for serialization to MongoDB