public async Task <AccountResult> LoginAccount(string Identifier, string Password)
        {
            AccountResult result = new AccountResult();

            result.CookieId   = "";
            result.CookieHash = "";
            if ((Identifier != null) && (Password != null))
            {
                byte[]  hashedPassword = Account.HashPassword(Password);
                Account target;
                if (Identifier.Contains("@"))
                {
                    target = await database.Accounts.Where(i => (!i.UseFacebook) && (i.Email.ToLower() == Identifier.ToLower()) && (i.PasswordHashed == hashedPassword)).FirstOrDefaultAsync();
                }
                else
                {
                    target = await database.Accounts.Where(i => (!i.UseFacebook) && (i.Username.ToLower() == Identifier.ToLower()) && (i.PasswordHashed == hashedPassword)).FirstOrDefaultAsync();
                }
                if (target != null)
                {
                    result.Ok         = true;
                    result.CookieId   = target.Id.ToString();
                    result.CookieHash = Convert.ToBase64String(hashedPassword);
                    return(result);
                }
            }
            result.Ok = false;
            return(result);
        }
        public async Task <AccountResult> LoginAccountFacebook(string FacebookID)
        {
            AccountResult result = new AccountResult();

            result.CookieId   = "";
            result.CookieHash = "";
            if (FacebookID != null)
            {
                Account target;
                target = await database.Accounts.Where(i => (i.UseFacebook) && (i.FacebookID == FacebookID)).FirstOrDefaultAsync();

                if (target != null)
                {
                    result.Ok         = true;
                    result.CookieId   = target.Id.ToString();
                    result.CookieHash = Convert.ToBase64String(target.PasswordHashed);
                    return(result);
                }
            }
            result.Ok = false;
            return(result);
        }