public static void Main() { IEnumerable <InputClass> allItems = someBLL.GetAllItems(); int?someParentNode = 1; var allChildItems = InputClass.GetAllChildNodesRecursivrly(someParentNode, allItems); }