private static IReadOnlyDictionary<Type, ProvisioningJobHandler> GetJobHandlersByExecutionModel(
            PnPPartnerPackConfigurationProvisioningJobsJobTypeExecutionModel executionModel)
        {
            Dictionary<Type, ProvisioningJobHandler> handlers = new Dictionary<Type, ProvisioningJobHandler>();

            // Browse through the configured Job Handlers
            if (_configuration.ProvisioningJobs != null &&
                _configuration.ProvisioningJobs.JobHandlers != null)
            {
                foreach (var jobHandlerKind in _configuration.ProvisioningJobs.JobHandlers)
                {
                    // Create an instance of the Job Handler
                    Type jobHandlerType = Type.GetType(jobHandlerKind.type, true);
                    ProvisioningJobHandler jobHandler = (ProvisioningJobHandler)Activator.CreateInstance(jobHandlerType);

                    // If there is any configuration XML element
                    if (jobHandlerKind.Configuration != null)
                    {
                        // Convert it into a XElement
                        using (XmlReader reader = new XmlNodeReader(jobHandlerKind.Configuration))
                        {
                            XElement configuration = XElement.Load(reader);

                            // Initialize the Job Handler
                            jobHandler.Init(configuration);
                        }
                    }

                    if (_configuration.ProvisioningJobs != null &&
                        _configuration.ProvisioningJobs.JobTypes != null)
                    {
                        // For each Job type associated with the current Job Handler
                        foreach (var jobKind in _configuration.ProvisioningJobs.JobTypes
                            .Where(j => j.executionModel == executionModel &&  j.handler == jobHandlerKind.name))
                        {
                            // Associate the Job type with the Job Handler
                            Type jobType = Type.GetType(jobKind.type, true);
                            handlers.Add(jobType, jobHandler);
                        }
                    }
                }
            }

            return (handlers);
        }
        private static IReadOnlyDictionary <Type, ProvisioningJobHandler> GetJobHandlersByExecutionModel(
            PnPPartnerPackConfigurationProvisioningJobsJobTypeExecutionModel executionModel)
        {
            Dictionary <Type, ProvisioningJobHandler> handlers = new Dictionary <Type, ProvisioningJobHandler>();

            // Browse through the configured Job Handlers
            if (_configuration.ProvisioningJobs != null &&
                _configuration.ProvisioningJobs.JobHandlers != null)
            {
                foreach (var jobHandlerKind in _configuration.ProvisioningJobs.JobHandlers)
                {
                    // Create an instance of the Job Handler
                    Type jobHandlerType = Type.GetType(jobHandlerKind.type, true);
                    ProvisioningJobHandler jobHandler = (ProvisioningJobHandler)Activator.CreateInstance(jobHandlerType);

                    // If there is any configuration XML element
                    if (jobHandlerKind.Configuration != null)
                    {
                        // Convert it into a XElement
                        using (XmlReader reader = new XmlNodeReader(jobHandlerKind.Configuration))
                        {
                            XElement configuration = XElement.Load(reader);

                            // Initialize the Job Handler
                            jobHandler.Init(configuration);
                        }
                    }

                    if (_configuration.ProvisioningJobs != null &&
                        _configuration.ProvisioningJobs.JobTypes != null)
                    {
                        // For each Job type associated with the current Job Handler
                        foreach (var jobKind in _configuration.ProvisioningJobs.JobTypes
                                 .Where(j => j.executionModel == executionModel && j.handler == jobHandlerKind.name))
                        {
                            // Associate the Job type with the Job Handler
                            Type jobType = Type.GetType(jobKind.type, true);
                            handlers.Add(jobType, jobHandler);
                        }
                    }
                }
            }

            return(handlers);
        }