/// <summary>
        /// This method checks if username and password are valid.
        /// </summary>
        /// <param name="password">User input for password.</param>
        public void LogInExecute(object obj)
        {
            CurrentUser.password = (obj as PasswordBox).Password;
            bool registered = service.IsRegisteredUser(currentUser.username);

            if (registered)
            {
                tblUser anUser = service.GetUserByUsernameAndPass(currentUser.username, currentUser.password);
                if (anUser != null)
                {
                    if (PasswordHasher.Verify(CurrentUser.password, anUser.password))
                    {
                        MessageBox.Show("Invalid password. Try again");
                    }
                    else
                    {
                        User userview = new User(anUser);
                        login.Close();
                        userview.ShowDialog();
                    }
                }
                else
                {
                    MessageBox.Show("Invalid password. Try again");
                }
            }
            else
            {
                if (validation.PasswordChecker(currentUser.password) == true)
                {
                    tblUser newUser = service.AddUser(currentUser.username, currentUser.password);
                    UserList = service.GetAllUsers();
                    MessageBox.Show("Successful registration.", "Notification");
                    EditUser edit = new EditUser(newUser);
                    edit.ShowDialog();
                    User userview = new User(newUser);
                    login.Close();
                    userview.ShowDialog();
                }
                else
                {
                    MessageBox.Show("The password must have minimum 5 characters.", "Notification");
                }
            }
        }
 /// <summary>
 /// This method checks if username and password are valid.
 /// </summary>
 /// <param name="password">User input for password.</param>
 public void LogInExecute(object password)
 {
     Password = (password as PasswordBox).Password;
     if (service.GetUserByUsername(Username) != null)
     {
         User = service.GetUserByUsername(Username);
         UserView userView = new UserView(User);
         login.Close();
         userView.ShowDialog();
     }
     else if (val.IsUniqueUsername(Username) == true)
     {
         if (val.PasswordChecker(Password) == true)
         {
             if (service.AddUser(Username, Password) == true)
             {
                 MessageBox.Show("Successful registration.", "Notification");
                 User = service.GetUserByUsername(Username);
                 UserView userView = new UserView(User);
                 userView.ShowDialog();
             }
             else
             {
                 MessageBox.Show("Registration Failed!", "Error");
             }
         }
         else
         {
             MessageBox.Show("The password must have minimum 6 characters with 2  uppercases.", "Notification");
         }
     }
     else
     {
         MessageBox.Show("Wrong username or password. Please, try again.", "Notification");
     }
 }