public static string GetFirstName(TLMessage25 message)
        {
            var message48 = message as TLMessage48;

            if (message48 != null)
            {
                if (message48.FwdHeader != null)
                {
                    var cacheService = InMemoryCacheService.Instance;
                    var channelId    = message48.FwdHeader.ChannelId;
                    if (channelId != null)
                    {
                        var channel = cacheService.GetChat(message48.FwdHeader.ChannelId) as TLChannel;
                        if (channel != null)
                        {
                            return(channel.Title.ToString());
                        }
                    }
                    else
                    {
                        var userId = message48.FwdHeader.FromId;
                        if (userId != null)
                        {
                            var fromUser = cacheService.GetUser(message48.FwdHeader.FromId);
                            if (fromUser != null)
                            {
                                return(TLUserBase.GetFirstName(fromUser.FirstName, fromUser.LastName, fromUser.Phone));
                            }
                        }
                    }
                }
            }

            if (message != null)
            {
                var fromUser = message.FwdFrom as TLUserBase;
                if (fromUser != null)
                {
                    return(TLUserBase.GetFirstName(fromUser.FirstName, fromUser.LastName, fromUser.Phone));
                }

                var fromChat = message.FwdFrom as TLChannel;
                if (fromChat != null)
                {
                    return(fromChat.Title.ToString());
                }

                var fromChatForbidden = message.FwdFrom as TLChannelForbidden;
                if (fromChatForbidden != null)
                {
                    return(fromChatForbidden.Title.ToString());
                }
            }

            return(null);
        }
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            var user = value as TLUserBase;

            if (user != null)
            {
                return(TLUserBase.GetFirstName(user.FirstName, user.LastName, user.Phone));
            }

            var chat = value as TLChatBase;

            if (chat != null)
            {
                return(chat.FullName);
            }

            return(value);
        }