public void Download(ImageContentModel imageContentModel, bool priority = false)
 {
     if (imageContentModel.LoadingState < LoadingState.Loaded) 
         if (priority)
         {
             if (!PriorityImages.Contains(imageContentModel))
             {
                 PriorityImages.Enqueue(imageContentModel);
                 _progressService.IncreaseMaxValue(ProgressType.Image, 1);
                 StartThreadIfNecessary();
             }
         }
         else if (!SecondaryImages.Contains(imageContentModel))
         {
             SecondaryImages.Enqueue(imageContentModel);
             _progressService.IncreaseMaxValue(ProgressType.Image, 1);
             StartThreadIfNecessary();
         }
 }
        private async Task DownloadImagesTask(ImageContentModel model)
        {
            try
            {
                if (!await _permissionsService.CanDownloadImages())
                    return;

                if (model.LoadingState != LoadingState.New)
                    return;

                var model1 = model;
                _platformCodeService.CheckBeginInvokeOnUi(() =>
                {
                    model1.LoadingState = LoadingState.Loading;
                });

                var img = await _platformCodeService.DownloadResizeImage(new Uri(model.Url), _maxHeight, _maxWidth).ConfigureAwait(false);

                _platformCodeService.CheckBeginInvokeOnUi(() =>
                {
                    model1.Image = img;
                    model1.LoadingState = LoadingState.Loaded;
                }, async () => { await _genericRepository.SaveAsyc(model1); });
            }
            catch (Exception ex)
            {
                model.LoadingState = LoadingState.LoadingFailed;
                await _genericRepository.SaveAsyc(model);
                LogHelper.Instance.LogException(ex);
            }
        }