static IPortModel GetFirstPortModelOfType(TypeHandle typeHandle, IEnumerable <IPortModel> portModels, bool fallbackToFirstPort)
        {
            Stencil    stencil          = portModels.First().VSGraphModel.Stencil;
            IPortModel unknownPortModel = null;

            // Return the first matching Input portModel
            // If no match was found, return the first Unknown typed portModel
            // Else return null.
            foreach (IPortModel portModel in portModels)
            {
                if (portModel.DataTypeHandle == TypeHandle.Unknown && unknownPortModel == null)
                {
                    unknownPortModel = portModel;
                }

                if (typeHandle.IsAssignableFrom(portModel.DataTypeHandle, stencil))
                {
                    return(portModel);
                }
            }

            if (unknownPortModel != null)
            {
                return(unknownPortModel);
            }
            return(fallbackToFirstPort ? portModels.FirstOrDefault() : null);
        }