public EmailProviderPageViewModel(INavigationService navigationService)
 {
     _emailProvider = new Accounts();
     _hasChanges = false;
     _navigationService = navigationService;
     SaveCommand = DelegateCommand.FromAsyncHandler(Save ,() => this.ReadyForSave());
 }
        public override async void OnNavigatedTo(NavigatedToEventArgs e, Dictionary<string, object> viewModelState)
        {
            string errorMessage = string.Empty;
            try
           {
                LoadingData = true;
                var parameter = (AccountPageParameters)e.Parameter;
                if (e.NavigationMode == NavigationMode.New)
                {
                    if ((parameter != null) && (parameter.Account != 0))
                    {
                        _emailProvider = new Accounts();
                    }
                    else
                    {
                        var db = Database.DbConnection;
                       _emailProvider = await db.FindAsync<Accounts>(f => f.Id == parameter.Account);
                        if (_emailProvider == null)
                        {
                            _emailProvider = new Accounts();
                        } 
                    }
                }
               _folderTree = parameter?.FolderTree;
           }
            catch (Exception ex)
            {
                errorMessage = string.Format(CultureInfo.CurrentCulture,
                "GeneralServiceErrorMessage",
                Environment.NewLine,
                ex.Message);
            }
            finally
            {
                LoadingData = false;
            }

        }