@Override
public void saveToStorage(Set<PersistentSubscription> newState) {
clean();
FudgeSerializer serializer = new FudgeSerializer(OpenGammaFudgeContext.getInstance());
FudgeDeserializer deserializer = new FudgeDeserializer(OpenGammaFudgeContext.getInstance());
List<DBObject> objects = new ArrayList<DBObject>();
for (PersistentSubscription sub : newState) {
FudgeMsg msg = LiveDataSpecificationFudgeBuilder.toFudgeMsg(serializer, sub.getFullyQualifiedSpec());
DBObject fieldData = deserializer.fudgeMsgToObject(DBObject.class, msg);
BasicDBObject mainObject = new BasicDBObject();
mainObject.append("fieldData", fieldData);
objects.add(mainObject);
}
_mongoCollection.insert(objects);