private void DeploySearchConfiguration(object modelHost, Site site, SearchConfigurationDefinition definition)
        {
            var context = site.Context;

            var conf = new SearchConfigurationPortability(context);
            var owner = new SearchObjectOwner(context, SearchObjectLevel.SPSite);

            InvokeOnModelEvent(this, new ModelEventArgs
            {
                CurrentModelNode = null,
                Model = null,
                EventType = ModelEventType.OnProvisioning,
                Object = conf,
                ObjectType = typeof(SearchConfigurationPortability),
                ObjectDefinition = definition,
                ModelHost = modelHost
            });

            conf.ImportSearchConfiguration(owner, definition.SearchConfiguration);

            InvokeOnModelEvent(this, new ModelEventArgs
            {
                CurrentModelNode = null,
                Model = null,
                EventType = ModelEventType.OnProvisioned,
                Object = conf,
                ObjectType = typeof(SearchConfigurationPortability),
                ObjectDefinition = definition,
                ModelHost = modelHost
            });

            context.ExecuteQueryWithTrace();
        }
 public static ModelNode AddSearchConfiguration(this ModelNode model, SearchConfigurationDefinition definition, Action<ModelNode> action)
 {
     return model.AddDefinitionNode(definition, action);
 }
 public static ModelNode AddSearchConfiguration(this ModelNode model, SearchConfigurationDefinition definition)
 {
     return AddSearchConfiguration(model, definition, null);
 }