/// <summary>
        /// Because the app has registered to support "Photos" extension the agent will be invoked
        /// and requested to download each image binary on a per need basis (e.g.: the user
        /// has tapped on the photo). We only receive this operation for the albums that require
        /// authentication (i.e. : we have explicitly set the property RequiresAuthentication = true)
        /// </summary>
        /// <param name="operation">The operation that we need to perform</param>
        private async Task ProcessOperation(DownloadImageOperation operation)
        {
            Logger.Log("Agent", "DownloadImageOperation(" + operation.PhotoId + ", " + operation.DesiredImageType + ")");

            try
            {
                OnlinePicture image = await manager.GetPictureByRemoteIdAsync(operation.PhotoId);

                // Download according to the desired image type

                if (operation.DesiredImageType == ImageType.SmallThumbnail)
                {
                    await image.SetThumbnailSmallAsync(await Helpers.MakeStreamFromUrl(image.ThumbnailSmallUrl));
                }
                else if (operation.DesiredImageType == ImageType.LargeThumbnail)
                {
                    await image.SetThumbnailLargeAsync(await Helpers.MakeStreamFromUrl(image.ThumbnailLargeUrl));
                }
                else if (operation.DesiredImageType == ImageType.FullSize)
                {
                    await image.SetContentAsync(await Helpers.MakeStreamFromUrl(image.ContentUrl));
                }

                await manager.SaveMediaItemAsync(image);
            }
            catch (Exception e)
            {
                Helpers.HandleException(e);
            }
            finally
            {
                operation.SafeNotifyCompletion();
            }
        }
        /// <summary>
        /// Because the app has registered to support "Photos" extension the agent will be invoked
        /// and requested to download each image binary on a per need basis (e.g.: the user 
        /// has tapped on the photo). We only receive this operation for the albums that require 
        /// authentication (i.e. : we have explicitly set the property RequiresAuthentication = true)
        /// </summary>
        /// <param name="operation">The operation that we need to perform</param>
        private async Task ProcessOperation(DownloadImageOperation operation)
        {
            Logger.Log("Agent", "DownloadImageOperation(" + operation.PhotoId + ", " + operation.DesiredImageType + ")");

            try
            {
                OnlinePicture image = await manager.GetPictureByRemoteIdAsync(operation.PhotoId);

                // Download according to the desired image type

                if (operation.DesiredImageType == ImageType.SmallThumbnail)
                {
                    await image.SetThumbnailSmallAsync(await Helpers.MakeStreamFromUrl(image.ThumbnailSmallUrl));
                }
                else if (operation.DesiredImageType == ImageType.LargeThumbnail)
                {
                    await image.SetThumbnailLargeAsync(await Helpers.MakeStreamFromUrl(image.ThumbnailLargeUrl));
                }
                else if (operation.DesiredImageType == ImageType.FullSize)
                {
                    await image.SetContentAsync(await Helpers.MakeStreamFromUrl(image.ContentUrl));
                }

                await manager.SaveMediaItemAsync(image);

            }
            catch (Exception e)
            {
                Helpers.HandleException(e);
            }
            finally
            {
                operation.SafeNotifyCompletion();
            }
        }