public ChatLogModel Quit() { var leadId = GetLeadId(); var sessionCache = _sessionCache.GetSessionEntry(leadId); if (sessionCache == null) { return(null); } var log = string.Join("\n", sessionCache.Chats.OrderBy(c => c.Item2).Select(c => c.Item1)); var tags = sessionCache.Tags.Keys.ToArray(); var chatlog = _crmService.SaveChatlog("chatbot_" + leadId, log, tags, sessionCache.LeadId); _sessionCache.Remove(leadId); return(chatlog); }