public TokenResponseViewModel GenerateTokenResponse(AppUser user, string role, string ip)
        {
            SecurityToken token = GetSecurityToken(user, role);

            string encodedToken = new JwtSecurityTokenHandler().WriteToken(token);
            string refreshToken = GenerateRefreshToken();

            SaveToken(user.Email, refreshToken, ip);

            return(new TokenResponseViewModel()
            {
                Token = encodedToken.Replace("/", "$").Replace("=", "@"),
                Email = user.Email,
                User = user.UserName,
                RefreshToken = refreshToken.Replace("/", "$").Replace("=", "@"),
                DisplayName = user.DisplayName,
                Role = role
            });
        }