private void AddComponent(MgaObject mgaComponentRef)
        {
            // [1] Find ModelName
            // [2] Find ModelType
            // [3] Find URL - search path
            // [4] Find Instance GUID
            // [5] CADParameters
            // [6] Create Protobuf Message
            // [7] Send message

            CyPhyML.ComponentRef componentRef = CyPhyMLClasses.ComponentRef.Cast(mgaComponentRef);

            // Does this component belong to the Meta-Linked assembly?
            if (!syncedComponents.ContainsKey(componentRef.ParentContainer.Guid.ToString()) && !syncedComponents.ContainsKey(componentRef.Guid.ToString())) return;

            CyPhyML.Component component = componentRef.Referred.Component;
            if (component != null)
            {

                // [6] Create Protobuf message
                MetaLinkProtobuf.Edit message = AddComponentProtoBufMsg(componentRef);

                if (message != null)
                {

                    // [6.5] Add SearchPath to message
                    try
                    {
                        var env = new MetaLinkProtobuf.Environment
                        {
                            name = SearchPathStr,
                        };

                        AddSearchPathToEnvironment(component, env);

                        if (env.value.Count > 0)
                        {
                            message.actions[0].environment.Add(env);
                        }
                    }
                    catch (IOException)
                    {
                        // XXX
                    }

                    // [7] Send message
                    bridgeClient.SendToMetaLinkBridge(message);
                }
            }
        }
        public void SendCadAssemblyXml(string xml, string assemblyGuid, bool clear)
        {
            MetaLinkProtobuf.Edit message = new MetaLinkProtobuf.Edit
            {
                editMode = Edit.EditMode.POST,
            };
            message.topic.Add(CadAssemblyTopic);
            message.topic.Add(assemblyGuid);
            if (clear)
            {
                message.actions.Add(new edu.vanderbilt.isis.meta.Action()
                {
                    actionMode = MetaLinkProtobuf.Action.ActionMode.CLEAR
                });
            }
            var action = new MetaLinkProtobuf.Action();
            message.actions.Add(action);
            action.actionMode = MetaLinkProtobuf.Action.ActionMode.INSERT;
            MetaLinkProtobuf.Alien alien = new MetaLinkProtobuf.Alien();
            action.alien = alien;
            alien.encoded = Encoding.UTF8.GetBytes(xml);
            alien.encodingMode = Alien.EncodingMode.XML;

            CyPhyML.ComponentAssembly targetAssembly = CyphyMetaLinkUtils.GetComponentAssemblyByGuid(addon.Project, assemblyGuid);
            if (targetAssembly != null)
            {
                var filter = targetAssembly.Impl.Project.CreateFilter();
                filter.Kind = "ComponentRef";
                try
                {
                    var env = new MetaLinkProtobuf.Environment
                    {
                        name = SearchPathStr,
                    };

                    foreach (var component in CyphyMetaLinkUtils.CollectComponentsRecursive(targetAssembly))
                    {
                        if (component is CyPhyML.Component)
                            AddSearchPathToEnvironment(component as CyPhyML.Component, env);
                    }

                    if (env.value.Count > 0)
                    {
                        action.environment.Add(env);
                    }
                }
                catch (IOException)
                {
                    // XXX
                }
            }

            bridgeClient.SendToMetaLinkBridge(message);
        }