private static bool ReadyToInstantiate(ComponentConfiguration config, IReadOnlyList <ComponentEnvironment> instantiatedEnvs)
        {
            var instantiatedConfigs = instantiatedEnvs.Select(e => e.Configuration).ToArray();

            //check input
            foreach (var inputConfig in config.Inputs)
            {
                var inputMeta = config.FindPortMetadata(inputConfig.LocalPort);
                var dataType  = config.FindInputPortDataType(inputMeta, instantiatedConfigs);
                if (dataType is null)
                {
                    return(false);
                }
                //check whether remote is instantiated
                if (!instantiatedEnvs.Any(e => e.Configuration.Id == inputConfig.RemoteId))
                {
                    return(false);
                }
            }
            //check output
            foreach (var remote in instantiatedConfigs)
            {
                foreach (var remoteInputConfig in remote.Inputs.Where(i => i.RemoteId == config.Id))
                {
                    var outputMeta = config.FindPortMetadata(remoteInputConfig.RemotePort);
                    var dataType   = config.FindOutputPortDataType(outputMeta, instantiatedConfigs);
                    if (dataType is null)
                    {
                        return(false);
                    }
                }
            }
            return(true);
        }