/// <summary>
        /// Used to validate the user database password with the recieved one.
        /// </summary>
        /// <param name="user">{ApplicationUser} The user informations from the database.</param>
        /// <param name="plainTextPassword">{string} the recieved plain text password.</param>
        /// <returns>{bool} True if valid, False otherwise.</returns>
        public static bool ValidateUserCredentials(ApplicationUser user, string plainTextPassword)
        {
            string sha1PwdHash   = PasswrodHelper.GenerateSha1HashBase64(plainTextPassword, user.PasswordPublicSalt);
            string sha512PwdHash = PasswrodHelper.GenerateSha512HashBase64(sha1PwdHash, user.PasswordPrivateSalt);

            return(PasswrodHelper.ValidatePassword(sha512PwdHash, user.PasswordHash as string));
        }
        /// <summary>
        /// Used To generate password hash and its salts based on the given plain text password.
        /// </summary>
        /// <param name="plainTextPassword">{String} plain text password.</param>
        /// <returns>{PasswordModel} Newly generated password.</returns>
        public static PasswordModel GenratePassword(string plainTextPassword)
        {
            var publicSalt      = PasswrodHelper.GenerateNewSaltBase64();
            var privateSalt     = PasswrodHelper.GenerateNewSaltBase64();
            var firstHashBase64 = PasswrodHelper.GenerateSha1HashBase64(plainTextPassword, publicSalt);
            var finalHash       = PasswrodHelper.GenerateSha512HashBase64(firstHashBase64, privateSalt);

            return(new PasswordModel()
            {
                Password = plainTextPassword,
                PasswordHash = finalHash,
                PasswordPublicSalt = publicSalt,
                PasswordPrivateSalt = privateSalt,
            });
        }
        /// <summary>
        /// Used to Generate a random password with the public and private salt.
        /// </summary>
        /// <returns>{PasswordHolder} The Newly created password.</returns>
        public static PasswordModel GenerateRandomPassword()
        {
            var random = new byte[8];

            new RNGCryptoServiceProvider().GetBytes(random);
            var password        = Convert.ToBase64String(random);
            var publicSalt      = PasswrodHelper.GenerateNewSaltBase64();
            var privateSalt     = PasswrodHelper.GenerateNewSaltBase64();
            var firstHashBase64 = PasswrodHelper.GenerateSha1HashBase64(password, publicSalt);
            var finalHash       = PasswrodHelper.GenerateSha512HashBase64(firstHashBase64, privateSalt);

            return(new PasswordModel()
            {
                Password = password,
                PasswordHash = finalHash,
                PasswordPublicSalt = publicSalt,
                PasswordPrivateSalt = privateSalt,
            });
        }