Updated sync code for realms.
merge.
Merge branch 'test' into dev