Added sync functionality between server db and local db