public virtual JToken SerializeJson(JToken outputObject)
{
if (outputObject == null)
{
outputObject = new JObject();
}
JArray attachmentsSequence = null;
if (this.Attachments != null)
{
//if (this.Attachments is ILazyCollection<Attachment> == false || ((ILazyCollection<Attachment>)this.Attachments).IsInitialized)
if (this.Attachments is ICollection<Attachment> == false)
{
attachmentsSequence = new JArray();
outputObject["attachments"] = attachmentsSequence;
foreach (Attachment attachmentsItem in this.Attachments)
{
if (attachmentsItem != null)
{
attachmentsSequence.Add(attachmentsItem.SerializeJson(null));
}
}
}
}
if (this.ChannelData != null)
{
outputObject["channelData"] = JObject.Parse(this.ChannelData);
}
if (this.ConversationId != null)
{
outputObject["conversationId"] = this.ConversationId;
}
if (this.Created != null)
{
outputObject["created"] = this.Created.Value;
}
if (this.ETag != null)
{
outputObject["eTag"] = this.ETag;
}
if (this.From != null)
{
outputObject["from"] = this.From;
}
if (this.Id != null)
{
outputObject["id"] = this.Id;
}
JArray imagesSequence = null;
if (this.Images != null)
{
//if (this.Images is ILazyCollection<string> == false || ((ILazyCollection<string>)this.Images).IsInitialized)
if (this.Images is ICollection<string> == false)
{
imagesSequence = new JArray();
outputObject["images"] = imagesSequence;
foreach (string imagesItem in this.Images)
{
if (imagesItem != null)
{
imagesSequence.Add(imagesItem);
}
}
}
}
if (this.Text != null)
{
outputObject["text"] = this.Text;
}
return outputObject;
}
}