private async Task <List <ChatResponse> > MapMessages(IList <InstantMessageResponse> messages, Guid conferenceId) { var response = new List <ChatResponse>(); if (!messages.Any()) { return(response); } var conference = await _conferenceCache.GetOrAddConferenceAsync ( conferenceId, () => _videoApiClient.GetConferenceDetailsByIdAsync(conferenceId) ); var username = User.Identity.Name; foreach (var message in messages) { var isUser = _messageDecoder.IsMessageFromUser(message, username); string fromDisplayName; if (isUser) { fromDisplayName = "You"; } else { fromDisplayName = await _messageDecoder.GetMessageOriginatorAsync(conference, message); } var mapped = ChatResponseMapper.MapToResponseModel(message, fromDisplayName, isUser); response.Add(mapped); } return(response); }