public ETextingDomainModel.AuthToken CreateAuthToken(ETextingDomainModel.ApiUser user, System.Security.Cryptography.HMACSHA256 provider)
 {
     var rawTokenInfo = string.Concat(user.AppId + DateTime.UtcNow.ToString("d"));
     var rawTokenByte = Encoding.UTF8.GetBytes(rawTokenInfo);
     var token = provider.ComputeHash(rawTokenByte);
     var authToken = new AuthToken()
     {
         Token = Convert.ToBase64String(token),
         Expiration = DateTime.UtcNow.AddDays(7),
         ApiUser = user
     };
     return authToken;
 }
 public AuthTokenModel Create(AuthToken authToken)
 {
     return new AuthTokenModel()
     {
         Token = authToken.Token,
         Expiration = authToken.Expiration
     };
 }
 public bool Insert(AuthToken token)
 {
     try
     {
         _contex.AuthTokens.Add(token);
         return true;
     }
     catch
     {
         return false;
     }
 }