private static async Task CloseModal()
{
var currentPage = Application.Current.CurrentPage() as ContentPage;
if (currentPage != null)
{
var popupLayout = currentPage.Content as PopupLayout;
if (popupLayout != null && popupLayout.IsPopupActive)
{
await popupLayout.DismissPopup();
}
else
{
await NavigationHelper.PopModalAsync();
}
}
}