public void ReplaceChild(QueryNode old_child, QueryNode new_child) { int index = children.IndexOf(old_child); if(index < 0) { throw new ApplicationException("old_child does not exist"); } children.RemoveAt(index); children.Insert(index, new_child); }