private static void GetPendingChanges() { if (!PendingChanges.Any()) { return; } var changeSet = PendingChanges.Peek(); if (changeSet != null) { var doc = SyncVersion.GetDocumentTypeByCod(changeSet); // show Progress var percent = Convert.ToInt32(((double)index++ / (double)changesetsCount) * 100); ShowProgress(string.Format("{0}% {1}", percent, doc.DocumentName)); if (doc != null) { DoSync(doc, changeSet); PendingChanges.Pop(); } else { //TODO handle null Documents locally. PendingChanges.Pop(); } } if (PendingChanges.Any()) { GetPendingChanges(); } }