public bool ValidateUser(string userName, string password)
        {
            var context = NewContext;

            // check if user exists
            var user = (from c in context.UserAccounts
                        where c.PartitionKey == userName.ToLowerInvariant() &&
                              c.RowKey == UserAccountEntity.EntityKind
                        select c).FirstOrDefault();

            if (user == null)
            {
                Tracing.Error("User not found in Table Storage: " + userName);
                return false;
            }

            // check password
            var result = new PasswordCrypto().ValidatePassword(password, user.PasswordHash, user.Salt);
            if (result)
            {
                Tracing.Information("Successful sign-in: " + userName);
            }
            else
            {
                Tracing.Error("Invalid password for: " + userName);
            }

            return result;
        }
        public bool ValidateUser(string userName, string password)
        {
            var context = NewContext;

            // check if user exists
            var user = (from c in context.UserAccounts
                        where c.PartitionKey == userName.ToLowerInvariant() &&
                        c.RowKey == UserAccountEntity.EntityKind
                        select c).FirstOrDefault();

            if (user == null)
            {
                Tracing.Error("User not found in Table Storage: " + userName);
                return(false);
            }

            // check password
            var result = new PasswordCrypto().ValidatePassword(password, user.PasswordHash, user.Salt);

            if (result)
            {
                Tracing.Information("Successful sign-in: " + userName);
            }
            else
            {
                Tracing.Error("Invalid password for: " + userName);
            }

            return(result);
        }