Demonstration of Synchronization algorithm(http://havrl.blogspot.ie/2013/08/synchronization-algorithm-for.html).
I added some improvements. As algorithm presented on the blog is cannot create on the client, or delete.
Client applications should use client.Client API Server applications should use client.Server API
Calling sync method on the client.Client will do synchronization. Algorithm is tested extensively with random circumstance.