private BlackboardStateSave SaveBlackboardState() { BlackboardStateSave save = new BlackboardStateSave(); foreach (KeyValuePair <string, BlackboardVariable> entry in blackboard.AsList()) { if (entry.Value == null || entry.Value.persistenceType == PersistenceType.AlwaysPersist) { continue; } if (entry.Value.persistenceType == PersistenceType.SavedToFile) { save.savedEntries.Add(new KeyValuePair <string, BVarSave>(entry.Key, entry.Value.CreateSave())); } entry.Value.UndoChanges(); } return(save); }