/// <summary>
        /// Download all images attached to the GUI List Control
        /// TODO: Make part of a GUI Base Window
        /// </summary>
        /// <param name="itemsWithThumbs">List of images to get</param>
        internal static void GetImages(List <GUITmdbImage> itemsWithThumbs, bool downloadFanart = true)
        {
            StopDownload = false;

            // split the downloads in 5+ groups and do multithreaded downloading
            int groupSize = (int)Math.Max(1, Math.Floor((double)itemsWithThumbs.Count / 5));
            int groups    = (int)Math.Ceiling((double)itemsWithThumbs.Count() / groupSize);

            for (int i = 0; i < groups; i++)
            {
                var groupList = new List <GUITmdbImage>();
                for (int j = groupSize * i; j < groupSize * i + (groupSize * (i + 1) > itemsWithThumbs.Count ? itemsWithThumbs.Count - groupSize * i : groupSize); j++)
                {
                    groupList.Add(itemsWithThumbs[j]);
                }

                new Thread(delegate(object o)
                {
                    var items = (List <GUITmdbImage>)o;
                    foreach (var item in items)
                    {
                        if (item.PeopleImages != null)
                        {
                            // stop download if we have exited window
                            if (StopDownload)
                            {
                                break;
                            }

                            var peopleImages = TmdbCache.GetPersonImages(item.PeopleImages.Id);
                            if (peopleImages == null)
                            {
                                return;
                            }

                            item.PeopleImages = peopleImages;

                            string remoteThumb = TmdbCache.GetPersonHeadshotUrl(peopleImages);
                            string localThumb  = TmdbCache.GetPersonHeadshotFilename(peopleImages);

                            if (!string.IsNullOrEmpty(remoteThumb) && !string.IsNullOrEmpty(localThumb))
                            {
                                if (GUIImageHandler.DownloadImage(remoteThumb, localThumb))
                                {
                                    // notify that image has been downloaded
                                    item.NotifyPropertyChanged("HeadShot");
                                }
                            }

                            // not all methods have Fanart for people
                            // only get it, if we need it
                            //if (downloadFanart && item.PeopleImages.Fanart != null)
                            //{
                            //    remoteThumb = TraktSettings.DownloadFullSizeFanart ? item.PeopleImages.Fanart.FullSize : item.PeopleImages.Fanart.MediumSize;
                            //    localThumb = item.PeopleImages.Fanart.LocalImageFilename(ArtworkType.PersonFanart);

                            //    if (!string.IsNullOrEmpty(remoteThumb) && !string.IsNullOrEmpty(localThumb))
                            //    {
                            //        if (GUIImageHandler.DownloadImage(remoteThumb, localThumb))
                            //        {
                            //            // notify that image has been downloaded
                            //            item.NotifyPropertyChanged("Fanart");
                            //        }
                            //    }
                            //}
                        }
                    }
                })
                {
                    IsBackground = true,
                    Name         = "ImageDownloader" + i.ToString()
                }.Start(groupList);
            }
        }
        /// <summary>
        /// Download all images attached to the GUI List Control
        /// TODO: Make part of a GUI Base Window
        /// </summary>
        /// <param name="itemsWithThumbs">List of images to get</param>
        internal static void GetImages(List <GUITmdbImage> itemsWithThumbs)
        {
            StopDownload = false;

            // split the downloads in 5+ groups and do multithreaded downloading
            int groupSize = (int)Math.Max(1, Math.Floor((double)itemsWithThumbs.Count / 5));
            int groups    = (int)Math.Ceiling((double)itemsWithThumbs.Count() / groupSize);

            for (int i = 0; i < groups; i++)
            {
                var groupList = new List <GUITmdbImage>();
                for (int j = groupSize * i; j < groupSize * i + (groupSize * (i + 1) > itemsWithThumbs.Count ? itemsWithThumbs.Count - groupSize * i : groupSize); j++)
                {
                    groupList.Add(itemsWithThumbs[j]);
                }

                new Thread(delegate(object o)
                {
                    var items = (List <GUITmdbImage>)o;
                    foreach (var item in items)
                    {
                        string remoteThumb = string.Empty;
                        string localThumb  = string.Empty;

                        #region Seasons / Episodes
                        if (item.SeasonImages != null)
                        {
                            // check if we have the image in our cache
                            var seasonImages = TmdbCache.GetSeasonImages(item.SeasonImages.Id, item.SeasonImages.Season);
                            if (seasonImages == null)
                            {
                                continue;
                            }

                            item.SeasonImages = seasonImages;

                            #region Show Season Poster
                            // stop download if we have exited window
                            if (StopDownload)
                            {
                                break;
                            }

                            remoteThumb = TmdbCache.GetSeasonPosterUrl(seasonImages);
                            localThumb  = TmdbCache.GetSeasonPosterFilename(seasonImages);

                            if (!string.IsNullOrEmpty(remoteThumb) && !string.IsNullOrEmpty(localThumb))
                            {
                                if (GUIImageHandler.DownloadImage(remoteThumb, localThumb))
                                {
                                    if (StopDownload)
                                    {
                                        break;
                                    }

                                    // notify that image has been downloaded
                                    item.NotifyPropertyChanged("SeasonPoster");
                                }
                            }
                            #endregion
                        }
                        #endregion

                        #region Shows / Seasons / Episodes
                        if (item.ShowImages != null)
                        {
                            #region Show Poster

                            var showImages = TmdbCache.GetShowImages(item.ShowImages.Id);
                            if (showImages == null)
                            {
                                continue;
                            }

                            item.ShowImages = showImages;

                            // don't download the show poster if we have a season poster
                            if (item.SeasonImages == null || item.SeasonImages.Posters == null || item.SeasonImages.Posters.Count == 0)
                            {
                                // stop download if we have exited window
                                if (StopDownload)
                                {
                                    break;
                                }

                                remoteThumb = TmdbCache.GetShowPosterUrl(showImages);
                                localThumb  = TmdbCache.GetShowPosterFilename(showImages);

                                if (!string.IsNullOrEmpty(remoteThumb) && !string.IsNullOrEmpty(localThumb))
                                {
                                    if (GUIImageHandler.DownloadImage(remoteThumb, localThumb))
                                    {
                                        if (StopDownload)
                                        {
                                            break;
                                        }

                                        // notify that image has been downloaded
                                        item.NotifyPropertyChanged("ShowPoster");
                                    }
                                }
                            }
                            #endregion

                            #region Fanart
                            // stop download if we have exited window
                            if (StopDownload)
                            {
                                break;
                            }
                            if (!TraktSettings.DownloadFanart)
                            {
                                continue;
                            }

                            string remoteFanart = TmdbCache.GetShowBackdropUrl(showImages);;
                            string localFanart  = TmdbCache.GetShowBackdropFilename(showImages);

                            if (!string.IsNullOrEmpty(remoteFanart) && !string.IsNullOrEmpty(localFanart))
                            {
                                if (GUIImageHandler.DownloadImage(remoteFanart, localFanart))
                                {
                                    if (StopDownload)
                                    {
                                        break;
                                    }

                                    // notify that image has been downloaded
                                    item.NotifyPropertyChanged("Fanart");
                                }
                            }
                            #endregion
                        }
                        #endregion

                        #region Movies
                        if (item.MovieImages != null)
                        {
                            // check if we have the image in our cache
                            var movieImages = TmdbCache.GetMovieImages(item.MovieImages.Id);
                            if (movieImages == null)
                            {
                                continue;
                            }

                            item.MovieImages = movieImages;

                            #region Movie Poster
                            // stop download if we have exited window
                            if (StopDownload)
                            {
                                break;
                            }

                            remoteThumb = TmdbCache.GetMoviePosterUrl(movieImages);
                            localThumb  = TmdbCache.GetMoviePosterFilename(movieImages);

                            if (!string.IsNullOrEmpty(remoteThumb) && !string.IsNullOrEmpty(localThumb))
                            {
                                if (GUIImageHandler.DownloadImage(remoteThumb, localThumb))
                                {
                                    if (StopDownload)
                                    {
                                        break;
                                    }

                                    // notify that image has been downloaded
                                    item.NotifyPropertyChanged("MoviePoster");
                                }
                            }
                            #endregion

                            #region Fanart
                            // stop download if we have exited window
                            if (StopDownload)
                            {
                                break;
                            }
                            if (!TraktSettings.DownloadFanart)
                            {
                                continue;
                            }

                            string remoteFanart = TmdbCache.GetMovieBackdropUrl(movieImages);;
                            string localFanart  = TmdbCache.GetMovieBackdropFilename(movieImages);

                            if (!string.IsNullOrEmpty(remoteFanart) && !string.IsNullOrEmpty(localFanart))
                            {
                                if (GUIImageHandler.DownloadImage(remoteFanart, localFanart))
                                {
                                    if (StopDownload)
                                    {
                                        break;
                                    }

                                    // notify that image has been downloaded
                                    item.NotifyPropertyChanged("Fanart");
                                }
                            }
                            #endregion
                        }
                        #endregion

                        #region People

                        if (item.PeopleImages != null)
                        {
                            // check if we have the image in our cache
                            var peopleImages = TmdbCache.GetPersonImages(item.PeopleImages.Id);
                            if (peopleImages == null)
                            {
                                continue;
                            }

                            item.PeopleImages = peopleImages;

                            #region Headshot
                            // stop download if we have exited window
                            if (StopDownload)
                            {
                                break;
                            }

                            remoteThumb = TmdbCache.GetPersonHeadshotUrl(peopleImages);
                            localThumb  = TmdbCache.GetPersonHeadshotFilename(peopleImages);

                            if (!string.IsNullOrEmpty(remoteThumb) && !string.IsNullOrEmpty(localThumb))
                            {
                                if (GUIImageHandler.DownloadImage(remoteThumb, localThumb))
                                {
                                    if (StopDownload)
                                    {
                                        break;
                                    }

                                    // notify that image has been downloaded
                                    item.NotifyPropertyChanged("HeadShot");
                                }
                            }
                            #endregion
                        }

                        #endregion
                    }
                })
                {
                    IsBackground = true,
                    Name         = "ImageDownloader" + i.ToString()
                }.Start(groupList);
            }
        }