private void SortEntity()
{
TreeNode tn = this.treeView.SelectedNode;
DocEntity docEntity = (DocEntity)tn.Tag;
DocSchema docSchema = (DocSchema)this.treeView.SelectedNode.Parent.Parent.Tag;
int indexOld = docSchema.Entities.IndexOf(docEntity);
docSchema.SortEntities();
int indexNew = docSchema.Entities.IndexOf(docEntity);
if (indexNew != indexOld)
{
TreeNode tnParent = tn.Parent;
tn.Remove();
tnParent.Nodes.Insert(indexNew, tn);
this.treeView.SelectedNode = tn;
}
}