/// <summary>
        /// Add a new user from gui
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private async void NewAccountButton_Click(object sender, RoutedEventArgs e)
        {
            //check passwords match
            if (!newPasswordBox.Password.Equals(confirmPasswordBox.Password))
            {
                ErrorMessage.Text = passwordError;
            }
            else
            {
                //check user name lenght
                if (userNameInput.Text.Length < 2)
                {
                    ErrorMessage.Text = nameError;
                }
                else
                {
                    ErrorMessage.Text = "";
                    //Http request with created user
                    var user = new User {
                        Name = userNameInput.Text, Password = newPasswordBox.Password, Email = Email.Text
                    };
                    Res res = await Auth.AddNewUser(user);

                    //res succes new user created
                    if (res.Success)
                    {
                        App.NewUser = true;
                        //add user to local DB
                        DAO.AddNewUser(new User(userNameInput.Text, "PASSWORD_STORE_ONLINE", Email.Text));

                        //navigate to login page
                        Frame.Navigate(typeof(LoginView));
                    }
                    else
                    {
                        //user not created, server don't allow.
                        //Show error messages
                        switch (res.Code)
                        {
                        case "auth/invalid-email":
                            ErrorMessage.Text = emailErrorBad;
                            break;

                        case "auth/email-already-exists":
                            ErrorMessage.Text = emailErrorInUse;
                            break;

                        case "auth/invalid-password":
                            ErrorMessage.Text = passWordErrorShort;
                            break;
                        }
                    }
                }
            }
        }
        /// <summary>
        /// Syncronize the account, show error message or navigate to login page.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private async void SyncAccountButton_Click(object sender, RoutedEventArgs e)
        {
            var user = new User("no name", PasswordBox.Password, Email.Text);
            Res res  = await Auth.SignIn(user);

            if (res.Success)
            {
                UserRes userData = await Auth.GetUser(user);

                //create user account
                User userForCreate = new User(userData.DisplayName, "none", userData.Email);
                DAO.AddNewUser(userForCreate);

                //navigate to login windows
                Frame.Navigate(typeof(LoginView));
            }
            else
            {
                ErrorMessage.Text = errorMessageSyncAccount;
            }
        }