private void GetListOfFilesToSyncWithServer(CancellationToken token) { var tasks = new List <Task>(); using (var repository = new FranchiseRepository()) { repository.Db.Configuration.ValidateOnSaveEnabled = false; var query = repository.GetUnSyncListOfFiles(); var suscribe = query.ToObservable().Subscribe(syncListModel => tasks.Add(ExecuteGetUnSync(syncListModel, token))); Task.WaitAll(tasks.ToArray(), token); suscribe.Dispose(); } }