protected internal void CleanEntity()
{
if (this.InnerEntity == null || this.InnerEntity.HasElements || this.InnerEntity.HasAttributes)
{
return;
}
var parent = this.InnerEntity?.Parent;
if (parent == null)
{
this.InnerEntity = null;
return;
}
this.InnerEntity?.Remove();
this.InnerEntity = null;
if (this.ParentElement == null)
{
Clean(parent);
}
else
{
this.ParentElement.CleanEntity();
}
}