public static ActivityPost FromRpcModel(this THActivityPost post)
 {
     return(new ActivityPost(
                id: post.Id,
                text: post.Content.Text,
                imageUrl: post.Content.ImageUrl,
                createdAt: DateUtils.FromUnixTime(post.CreatedAt),
                buttonTitle: post.Content.Button != null ? post.Content.Button.ButtonTitle : null,
                buttonAction: post.Content.Button != null ? post.Content.Button.ButtonAction: null,
                action: post.Content.Button != null ? post.Content.Button.Action.FromRpcModel(): null,
                author: post.Author.ToPostAuthor(),
                commentsCount: post.CommentsCount,
                likesCount: post.LikesCount,
                isLikedByMe: post.LikedByMe,
                stickyStart: DateUtils.FromUnixTime(post.StickyStart),
                stickyEnd: DateUtils.FromUnixTime(post.StickyEnd),
                mentions: post.Mentions.ConvertAll(mention => mention.FromRpcModel()),
                feedId: GetFeedNameFromRPC(post.FeedId)
                ));
 }
        public void Read(TProtocol iprot)
        {
            iprot.IncrementRecursionDepth();
            try
            {
                TField field;
                iprot.ReadStructBegin();
                while (true)
                {
                    field = iprot.ReadFieldBegin();
                    if (field.Type == TType.Stop)
                    {
                        break;
                    }
                    switch (field.ID)
                    {
                    case 1:
                        if (field.Type == TType.Struct)
                        {
                            Activity = new THActivityPost();
                            Activity.Read(iprot);
                        }
                        else
                        {
                            TProtocolUtil.Skip(iprot, field.Type);
                        }
                        break;

                    case 2:
                        if (field.Type == TType.I32)
                        {
                            ReportsCount = iprot.ReadI32();
                        }
                        else
                        {
                            TProtocolUtil.Skip(iprot, field.Type);
                        }
                        break;

                    case 3:
                        if (field.Type == TType.I32)
                        {
                            ReportStatus = (THReportStatus)iprot.ReadI32();
                        }
                        else
                        {
                            TProtocolUtil.Skip(iprot, field.Type);
                        }
                        break;

                    case 4:
                        if (field.Type == TType.I32)
                        {
                            AuthorBanExpiry = iprot.ReadI32();
                        }
                        else
                        {
                            TProtocolUtil.Skip(iprot, field.Type);
                        }
                        break;

                    case 5:
                        if (field.Type == TType.I32)
                        {
                            DeletedAt = iprot.ReadI32();
                        }
                        else
                        {
                            TProtocolUtil.Skip(iprot, field.Type);
                        }
                        break;

                    default:
                        TProtocolUtil.Skip(iprot, field.Type);
                        break;
                    }
                    iprot.ReadFieldEnd();
                }
                iprot.ReadStructEnd();
            }
            finally
            {
                iprot.DecrementRecursionDepth();
            }
        }