public List <FlatTable> Flatten(List <SendTable> sendTables) { var flattened = new List <FlatTable>(); var nameMap = sendTables.ToDictionary(t => t.NetTableName, t => t); foreach (var table in sendTables) { var excluding = new HashSet <string>(); GatherExcludes(table, nameMap, excluding); var properties = new List <PropertyInfo>(); BuildHierarchy(properties, table, nameMap, excluding); SortProperties(properties); flattened.Add( FlatTable.CreateWith(table.NetTableName, table.NeedsDecoder, properties)); } return(flattened); }