protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs args)
        {
            base.OnNavigatedTo(args);
            if (App.RecursiveBack)
            {
                TransitionService.SetNavigationInTransition(this, null);
                TransitionService.SetNavigationOutTransition(this, null);
                NavigationService.GoBack();
                return;
            }

            IDictionary <string, string> parameters = NavigationContext.QueryString;

            Debug.Assert(parameters.ContainsKey("id"));
            ContentId = parameters["id"];

            if (PhoneApplicationService.Current.State.ContainsKey(KCataloguePageUpdateInProgress) &&
                (bool)(PhoneApplicationService.Current.State[KCataloguePageUpdateInProgress]))
            {
                PageType = LibraryModel.LibraryLevel.Catalogue;
                UpdateApplicationBarButtons();
                UpdateLibrary(App.Engine.LoggedUser.Libraries.First(library => library.ServerId == ContentId));
            }
            else
            {
                ReloadLibrary(parameters.ContainsKey("lib"));
                UpdateApplicationBarButtons();
            }

            // workaround for flicker during recursive back
            if (!ApplicationBar.IsVisible)
            {
                ApplicationBar.IsVisible = true;
            }
        }
        private void ReloadLibrary(bool forceReload)
        {
            IsLoaded = false;

            if (forceReload)
            {
                App.Engine.LibraryModel.LoadLibrary(ContentId);
            }
            else
            {
                App.Engine.LibraryModel.LoadLibraryStateIfNotLoaded();
            }
            PageType = App.Engine.LibraryModel.GetNodeType(ContentId);

            CollectionFilter.Source      = App.Engine.LibraryModel.GetDataSourceForId(ContentId);
            CollectionFilter.View.Filter = GetFilterPredicateForPageType(PageType);
            CollectionFilter.View.MoveCurrentToPosition(-1);
            TitlePanel.TitleText = App.Engine.LibraryModel.GetNodeTitle(ContentId);
            IsLoaded             = true;
        }