public async Task <AuthenticateResponse> RefreshToken(string token, string ipAddress) { var merchant = await _merchantRepository.FindByToken(token); if (merchant == null) { return(null); } var refreshToken = merchant.RefreshTokens.SingleOrDefault(x => x.Token == token); if (refreshToken?.IsActive == false) { return(null); } return(await GenerateToken(ipAddress, merchant, refreshToken)); }