public static IDictionary <ProtoCrewMember, Part> CrewInSection(IEnumerable <Part> sectionParts) { if (ShipConstruction.ShipManifest == null || ShipConstruction.ShipManifest.PartManifests == null || sectionParts == null) { return(new Dictionary <ProtoCrewMember, Part>()); } return(ShipConstruction.ShipManifest.GetAllCrew(false).Where(crew => crew != null) .Select(crew => new KeyValuePair <ProtoCrewMember, Part>(crew, ShipConstruction.FindPartWithCraftID(ShipConstruction.ShipManifest.GetPartForCrew(crew).PartID))) .Where(pair => sectionParts.Contains(pair.Value)).ToDictionary(pair => pair.Key, pair => pair.Value)); }