private static object GetDtoImage(BaseItemDto item, string imageType, IExtendedApiClient apiClient)
        {
            if (item.ImageTags.IsNullOrEmpty())
            {
                return("");
            }

            var imageOptions = new ImageOptions
            {
                Quality = 90,
#if WP8
                MaxHeight = 336,
#else
                MaxHeight = 173,
#endif
                ImageType = ImageType.Primary
            };

            if (imageType.Equals("logo", StringComparison.OrdinalIgnoreCase))
            {
                imageOptions.ImageType = ImageType.Logo;
            }
            else if (imageType.Equals("backdrop"))
            {
                imageOptions.MaxHeight = 800;
                imageOptions.ImageType = ImageType.Backdrop;

                var images = apiClient.GetBackdropImageUrls(item, imageOptions);
                if (!images.IsNullOrEmpty())
                {
                    return(images.FirstOrDefault());
                }
            }
            else if (imageType.Equals("primaryorbackdrop"))
            {
                if (!item.HasPrimaryImage)
                {
                    imageOptions.MaxHeight = 800;
                    imageOptions.ImageType = ImageType.Backdrop;

                    var images = apiClient.GetBackdropImageUrls(item, imageOptions);
                    if (!images.IsNullOrEmpty())
                    {
                        return(images.FirstOrDefault());
                    }
                }
            }
            else if (imageType.Equals("backdropsmall", StringComparison.OrdinalIgnoreCase))
            {
#if WP8
                imageOptions.MaxHeight = 336;
#else
                imageOptions.MaxHeight = 173;
#endif
                imageOptions.ImageType = ImageType.Backdrop;

                var images = apiClient.GetBackdropImageUrls(item, imageOptions);
                if (!images.IsNullOrEmpty())
                {
                    return(images.FirstOrDefault());
                }
            }
            else if (imageType.Equals("banner", StringComparison.OrdinalIgnoreCase))
            {
                imageOptions.MaxHeight = 140;
                imageOptions.ImageType = ImageType.Banner;
            }
            else if (imageType.Equals("art", StringComparison.OrdinalIgnoreCase))
            {
                imageOptions.ImageType = ImageType.Art;
            }
            else if (imageType.Equals("thumbnail", StringComparison.OrdinalIgnoreCase))
            {
                imageOptions.ImageType = ImageType.Thumb;
            }
            else if (imageType.Equals("icon", StringComparison.OrdinalIgnoreCase))
            {
#if WP8
                imageOptions.MaxHeight = 159;
#else
                imageOptions.MaxHeight = 90;
#endif
            }
            else if (imageType.Equals("poster", StringComparison.OrdinalIgnoreCase))
            {
#if WP8
                imageOptions.MaxHeight = 675;
#else
                imageOptions.MaxHeight = 450;
#endif
            }
            else if (imageType.Equals("episode", StringComparison.OrdinalIgnoreCase))
            {
#if WP8
                imageOptions.MaxHeight = 382;
#else
                imageOptions.MaxHeight = 255;
#endif
            }
            else
            {
#if WP8
                imageOptions.MaxHeight = 300;
#else
                imageOptions.MaxHeight = 200;
#endif
            }
            try
            {
                string url = item.Type == "Series" ? apiClient.GetImageUrl(item.Id, imageOptions) : apiClient.GetImageUrl(item, imageOptions);
                return(url);
            }
            catch
            {
                return("");
            }
        }
        private static object GetDtoImage(BaseItemDto item, string imageType, IExtendedApiClient apiClient)
        {
            if (item.ImageTags.IsNullOrEmpty())
            {
                return "";
            }

            var imageOptions = new ImageOptions
            {
                Quality = 90,
#if WP8
                MaxHeight = 336,
#else
                                               MaxHeight = 173,
#endif
                ImageType = ImageType.Primary
            };
            if (imageType.Equals("logo", StringComparison.OrdinalIgnoreCase))
            {
                imageOptions.ImageType = ImageType.Logo;
            }
            else if (imageType.Equals("backdrop"))
            {
                imageOptions.MaxHeight = 800;
                imageOptions.ImageType = ImageType.Backdrop;

                var images = apiClient.GetBackdropImageUrls(item, imageOptions);
                if (!images.IsNullOrEmpty())
                {
                    return images.FirstOrDefault();
                }
            }
            else if (imageType.Equals("primaryorbackdrop"))
            {
                if (!item.HasPrimaryImage)
                {
                    imageOptions.MaxHeight = 800;
                    imageOptions.ImageType = ImageType.Backdrop;

                    var images = apiClient.GetBackdropImageUrls(item, imageOptions);
                    if (!images.IsNullOrEmpty())
                    {
                        return images.FirstOrDefault();
                    }
                }
            }
            else if (imageType.Equals("backdropsmall", StringComparison.OrdinalIgnoreCase))
            {
#if WP8
                imageOptions.MaxHeight = 336;
#else
                        imageOptions.MaxHeight = 173;
#endif
                imageOptions.ImageType = ImageType.Backdrop;

                var images = apiClient.GetBackdropImageUrls(item, imageOptions);
                if (!images.IsNullOrEmpty())
                {
                    return images.FirstOrDefault();
                }
            }
            else if (imageType.Equals("banner", StringComparison.OrdinalIgnoreCase))
            {
                imageOptions.MaxHeight = 140;
                imageOptions.ImageType = ImageType.Banner;
            }
            else if (imageType.Equals("art", StringComparison.OrdinalIgnoreCase))
            {
                imageOptions.ImageType = ImageType.Art;
            }
            else if (imageType.Equals("thumbnail", StringComparison.OrdinalIgnoreCase))
            {
                imageOptions.ImageType = ImageType.Thumb;
            }
            else if (imageType.Equals("icon", StringComparison.OrdinalIgnoreCase))
            {
#if WP8
                imageOptions.MaxHeight = 159;
#else
                        imageOptions.MaxHeight = 90;
#endif
            }
            else if (imageType.Equals("poster", StringComparison.OrdinalIgnoreCase))
            {
#if WP8
                imageOptions.MaxHeight = 675;
#else
                        imageOptions.MaxHeight = 450;
#endif
            }
            else if (imageType.Equals("episode", StringComparison.OrdinalIgnoreCase))
            {
#if WP8
                imageOptions.MaxHeight = 382;
#else
                        imageOptions.MaxHeight = 255;
#endif
            }
            else
            {
#if WP8
                imageOptions.MaxHeight = 300;
#else
                        imageOptions.MaxHeight = 200;
#endif
            }
            try
            {
                string url = item.Type == "Series" ? apiClient.GetImageUrl(item.Id, imageOptions) : apiClient.GetImageUrl(item, imageOptions);
                return url;
            }
            catch
            {
                return "";
            }
        }