public async Task <MessageQueue> GetMessageQueue(string senderUsername, string receiverUsername) { var messageQueueKey = keyGenerator.GenerateForMessageQueue(senderUsername, receiverUsername); var messageQueueJson = await context.Redis.StringGetAsync(messageQueueKey); if (messageQueueJson.IsNullOrEmpty) { return(new MessageQueue(messageQueueKey, senderUsername, receiverUsername, new Queue <string>())); } var messageQueue = JsonConvert.DeserializeObject <MessageQueue>(messageQueueJson); return(messageQueue); }