...
get the list of local resources
for each remote region
get the list of remote resources
for each resource in the local list
if there is a remote resource that is linked to this local resource
compare the 'modified' datetimes of local & remote resources
if they are same, no work
if both attribute values are same, no work
otherwise,
if the remote is after the local, UPDATE local attribute values to those of the remote including 'modified' timestamp
if the local is after, no work (This will be sync'ed up in the remote region)
remove this local from the local list
remove this remote from the remote listotherwise, no work
for local resources that are still in the local list
find the latest removal event of the linked resource in the remote region
if an event is found in the remote region and the 'created' timestamp of the removal event is later than the 'created' timestamp of this local resource,
remove the local resource with remote event 'created' timestamp
remove this local from the local list
otherwise, no workfor remote resources that are still in the remote -to-do list
find if the local resource was removed
if it was removed and the 'removed' timestamp is later than the 'created' of the remote,
don't create this in the local region
otherwise,
create this resource in the local region with remote resource attribute values including 'created', 'modified'
remove this remote from the remote-to-do listremote list
...