private List <TaskSync> MergeTasks(List <TaskSync> tasksFromDb, List <TaskSync> tasksFromUser)
        {
            Dictionary <string, TaskSync> result = new Dictionary <string, TaskSync>();

            foreach (TaskSync task in tasksFromDb)
            {
                task.Id = 0;
                result.Remove(task.SourceId);
                result.Add(task.SourceId, task);
            }

            foreach (TaskSync task in tasksFromUser)
            {
                task.Id = 0;
                TaskSync tempTask = null;
                result.TryGetValue(task.SourceId, out tempTask);
                if (tempTask != null)
                {
                    DateTime tempTaskDate = tempTask.LastModifyDate;
                    DateTime taskDate     = task.LastModifyDate;
                    if (DateTime.Compare(tempTaskDate, taskDate) <= 0)
                    {
                        result.Remove(task.SourceId);
                        result.Add(task.SourceId, task);
                    }
                }
                else
                {
                    result.Add(task.SourceId, task);
                }
            }

            return(new List <TaskSync>(result.Values));
        }
        /// <summary>
        /// We don't need to return deleted tasks
        /// </summary>
        /// <param name="result"></param>
        private void RemoveDeleted(List <TaskSync> result)
        {
            int i = 0;

            while (i < result.Count)
            {
                TaskSync task = result[i];
                if (task.IsDeleted)
                {
                    result.RemoveAt(i);
                    continue;
                }
                i++;
            }
        }