private static IFlow <IGroupedFlow <Type, T> > GroupBySelectedTypes <T>(IFlow <T> flow, IEnumerable <Type> selectedTypes) => flow.GroupBy(x => selectedTypes.First(selectedType => IsSameOrSubclass(selectedType, x.GetType())));