public async Task GetSearchResultsAsync(string query, bool isFirstTimeLoadingVideos)
        {
            if (isFirstTimeLoadingVideos)
            {
                IsLoading = true;
                _searchResults.Clear();
                _numberOfVideosCurrentlyShown = 0;
                _resultPageCurrentlyShown     = 1;
            }
            else
            {
                AreAdditionalResultsBeingLoaded = true;
                _resultPageCurrentlyShown++;
            }

            AdditionalVideosFound = false;

            if (!String.IsNullOrWhiteSpace(query))
            {
                if (String.IsNullOrWhiteSpace(_apiKey))
                {
                    _apiKey = Services.ApiKeyManager.GetInstance().GetSavedApiKey();
                }

                var response = await GiantBombApi.Services.VideoRetrievalAgent.GetVideoSearchResultsAsync(_apiKey, query, _resultPageCurrentlyShown);

                if ((response != null) && (response.Status == StatusCode.OK) && (response.Results != null) && (response.Results.Count() > 0))
                {
                    ErrorText = null;
                    _numberOfVideosCurrentlyShown += response.Results.Count();

                    if (response.NumberOfTotalResults > _numberOfVideosCurrentlyShown)
                    {
                        AdditionalVideosFound = true;
                    }
                    else
                    {
                        AdditionalVideosFound = false;
                    }

                    foreach (var video in response.Results)
                    {
                        var viewModel = new VideoViewModel()
                        {
                            Id          = video.Id,
                            Title       = video.Name,
                            Description = video.Deck,
                            Source      = video
                        };

                        if (video.Image != null)
                        {
                            if (!String.IsNullOrWhiteSpace(video.Image.SuperUrl))
                            {
                                viewModel.ImageLocation = new Uri(video.Image.SuperUrl);
                            }
                            else if (!String.IsNullOrWhiteSpace(video.Image.MediumUrl))
                            {
                                viewModel.ImageLocation = new Uri(video.Image.MediumUrl);
                            }
                            else if (!String.IsNullOrWhiteSpace(video.Image.SmallUrl))
                            {
                                viewModel.ImageLocation = new Uri(video.Image.SmallUrl);
                            }
                        }

                        _searchResults.Add(viewModel);
                    }
                }
                else
                {
                    ErrorText = NoResultsFoundError;
                }
            }
            else
            {
                ErrorText = NoQueryEnteredError;
            }

            AreAdditionalResultsBeingLoaded = false;
            IsLoading = false;
        }
        public async Task LoadVideosAsync(bool isFirstTimeLoadingVideos)
        {
            try
            {
                if (isFirstTimeLoadingVideos)
                {
                    IsLoading   = true;
                    FoundVideos = false;
                    _numberOfVideosCurrentlyShown = 0;
                    _videos.Clear();
                    _subHeaderVideos.Clear();
                    _headerVideos.Clear();
                    _liveBroadcasts.Clear();
                }
                else
                {
                    AreAdditionalResultsBeingLoaded = true;
                }

                AdditionalVideosFound = false;
                VideosResponse response    = null;
                bool           isGroupPage = false;

                if ((this.Group == null) || (String.IsNullOrWhiteSpace(this.Group.Id)))
                {
                    await CheckForLiveStreamAsync();

                    response = await GiantBombApi.Services.VideoRetrievalAgent.GetVideosAsync(_apiKey, _numberOfVideosCurrentlyShown);
                }
                else
                {
                    isGroupPage      = true;
                    GroupTitle       = Group.Title;
                    GroupDescription = Group.Deck;
                    response         = await GiantBombApi.Services.VideoRetrievalAgent.GetVideosAsync(_apiKey, _numberOfVideosCurrentlyShown, Group.Id, Group.GroupingType);
                }

                if ((response != null) && (response.Status == StatusCode.OK) && (response.Results != null) && ((response.Results.Count() > 0)))
                {
                    FoundVideos = true;
                    _numberOfVideosCurrentlyShown += response.Results.Count();

                    if (response.NumberOfTotalResults > _numberOfVideosCurrentlyShown)
                    {
                        AdditionalVideosFound = true;
                    }
                    else
                    {
                        AdditionalVideosFound = false;
                    }

                    foreach (var video in response.Results)
                    {
                        int percentComplete = GiantBombApi.Services.VideoPlaybackPositionAgent.GetPlaybackPercentageComplete(video);
                        var viewModel       = new VideoViewModel()
                        {
                            Id                 = video.Id,
                            Title              = video.Name,
                            Description        = video.Deck,
                            Source             = video,
                            PercentageComplete = percentComplete
                        };

                        if (video.Image != null)
                        {
                            if (!String.IsNullOrWhiteSpace(video.Image.SuperUrl))
                            {
                                viewModel.ImageLocation = new Uri(video.Image.SuperUrl);
                            }
                            else if (!String.IsNullOrWhiteSpace(video.Image.MediumUrl))
                            {
                                viewModel.ImageLocation = new Uri(video.Image.MediumUrl);
                            }
                            else if (!String.IsNullOrWhiteSpace(video.Image.SmallUrl))
                            {
                                viewModel.ImageLocation = new Uri(video.Image.SmallUrl);
                            }
                        }

                        _videos.Add(viewModel);
                    }
                }

                // Add in the header and subheader view models
                if (isFirstTimeLoadingVideos)
                {
                    if (isGroupPage)
                    {
                        // Group page style, no header. Don't show anything unless we have a full
                        // second row (3 wide) of videos.
                        if (_videos.Count > (NumberOfSubHeadersOnGroupPage + 3))
                        {
                            var subHeaderViewModels = _videos.Take(NumberOfSubHeadersOnGroupPage);
                            foreach (var video in subHeaderViewModels)
                            {
                                _subHeaderVideos.Add(video);
                            }

                            for (int i = 0; i < NumberOfSubHeadersOnGroupPage; i++)
                            {
                                _videos.RemoveAt(0);
                            }
                        }
                    }
                    else
                    {
                        // Main page style, includes header. Don't show anything unless we have a full
                        // third row (3 wide) of videos.
                        if (_videos.Count > (NumberOfSubHeadersOnMainPage + 4))
                        {
                            if ((LiveBroadcasts == null) || (LiveBroadcasts.Count == 0))
                            {
                                _headerVideos.Add(_videos.First());
                                _videos.RemoveAt(0);
                            }

                            var subHeaderViewModels = _videos.Take(NumberOfSubHeadersOnMainPage);
                            foreach (var video in subHeaderViewModels)
                            {
                                _subHeaderVideos.Add(video);
                            }

                            for (int i = 0; i < NumberOfSubHeadersOnMainPage; i++)
                            {
                                _videos.RemoveAt(0);
                            }
                        }
                    }
                }
            }
            catch (Exception e)
            {
                Serilog.Log.Information(e, "Error loading videos");
            }

            AreAdditionalResultsBeingLoaded = false;
            IsLoading = false;
        }