public static async Task PopupGoBackAsync(this INavigationService navigationService, NavigationParameters parameters = null, bool animate = true)
        {
            if (s_popupStack.Count == 0)
            {
                return;
            }

            var page = s_popupStack.Last();

            EnsureParametersContainsMode(parameters ?? (parameters = PopupUtilities.CreateBackNavigationParameters()), NavigationMode.Back);

            HandleINavigatedAware(page, parameters, navigatedTo: false);
            HandleIDestructiblePage(page);

            await s_popupNavigation.PopAsync(animate);

            Page currentPage = s_popupStack.LastOrDefault();

            if (currentPage == null)
            {
                currentPage = GetCurrentPage();
            }

            HandleINavigatedAware(currentPage, parameters, navigatedTo: true);
        }
        private static void HandleINavigatedAware(Page page, NavigationParameters parameters, bool navigatedTo)
        {
            if (page == null)
            {
                return;
            }
            if (parameters == null)
            {
                parameters = navigatedTo ?
                             PopupUtilities.CreateNewNavigationParameters() :
                             PopupUtilities.CreateBackNavigationParameters();
            }

            PageUtilities.InvokeViewAndViewModelAction <INavigatedAware>(page, (view) => {
                if (navigatedTo)
                {
                    view.OnNavigatedTo(parameters);
                }
                else
                {
                    view.OnNavigatedFrom(parameters);
                }
            });

            PageUtilities.InvokeViewAndViewModelAction <IActiveAware>(page, (view) => view.IsActive = navigatedTo);
        }