public void AddPhotos(IList <string> paths) { if (paths.Count + this.Photos.Count > MaxPhotoUploadLimit) { this.WarningMessage = string.Format(CultureInfo.CurrentUICulture, Resources.MaxUploadWarning, MaxPhotoUploadLimit); } else { try { this.IsProcessingPhotos = true; Task.Factory.StartNew( () => paths.Except(this.photoPaths).Select(path => Photo.BuildPhotoFromPath(path)).ToArray(), CancellationToken.None) .ContinueWith( photoTask => { this.IsProcessingPhotos = false; foreach (var photo in photoTask.Result) { this.Photos.Add(photo); } }, CancellationToken.None, TaskContinuationOptions.None, TaskScheduler.FromCurrentSynchronizationContext()); } catch { this.IsProcessingPhotos = false; } } }