How to save the state of NSOutlineView?

Hi all, I built the NSOutlineView with NSTreeController, and I faced with the huge complexity of saving its state. Usage of Core Data is too tedious since I have implemented drag and drop support as well.


I want to implement saving to multiple storage types as locally, using Core Data, and iCloud syncing. So I am looking for the best way how to save the folders tree's state. E.g. I did drag and drop, or created a new folder, and closed the app. And next time when I'll open the app there should be exactly the same folders structure.


I am trying to achieve the same behavior of the catalog as in Apple Notes app.


So my question is more general. What is the best way to save its state? Is it achievable with NSCoding? Or should I use another approach?


Thanks in advance.