/// <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");
                }
            }
        }