public virtual XElement ToXml()
{
return new XElement(_rootElements[ResourceType],
new XAttribute("ID", ResourceID),
new XAttribute("Name", ResourceName ?? string.Empty),
new XAttribute("ResourceType", ResourceType),
new XAttribute("IsValid", IsValid),
new XElement("DisplayName", ResourceName ?? string.Empty),
new XElement("Category", ResourcePath ?? string.Empty),
new XElement("AuthorRoles", AuthorRoles ?? string.Empty),
// ReSharper disable ConstantNullCoalescingCondition
new XElement("ErrorMessages", WriteErrors() ?? null)
// ReSharper restore ConstantNullCoalescingCondition
);
}