Add model.serialize and collection.serialize methods