Snapshot support

- Implemented snapshot support. A snapshot can be stored locally and the hasChanges method will use a snapshot to see if there are changes if a snapshot is available.
- Clone no longer copies fields that start with $
Fails in the wrong way.