public async Task <MessageHistroy> GetMessageHistory(string who, string toWhom) { var messageHistoryKey = keyGenerator.GenerateForMessageHistory(who, toWhom); var messageHistoryJson = await context.Redis.StringGetAsync(messageHistoryKey); if (messageHistoryJson.IsNullOrEmpty) { var participants = new List <string>() { who, toWhom }; return(new MessageHistroy(messageHistoryKey, participants, new List <MessageEntity>())); } var messageHistory = JsonConvert.DeserializeObject <MessageHistroy>(messageHistoryJson); return(messageHistory); }