public Guid RunService(string accountid, string servicename, string options)
        {
            Guid guid;
            ChannelFactory <ISchedulingCommunication> channel   = new ChannelFactory <ISchedulingCommunication>("SeperiaSchedulerCommunication");
            ISchedulingCommunication    schedulingCommunication = channel.CreateChannel();
            Dictionary <string, string> settings = new Dictionary <string, string>();

            string[] settingsArray = options.Split(':');
            foreach (var setting in settingsArray)
            {
                string[] keyValue = setting.Split('=');
                settings.Add(keyValue[0], keyValue[1]);
            }
            guid = schedulingCommunication.AddUnplanedService(int.Parse(accountid), servicename, settings, DateTime.Now);
            return(guid);
        }
        private void _btnAddServicesClick(object sender, RoutedEventArgs e)
        {
            StringBuilder errors = new StringBuilder();

            foreach (UnplannedView accountView in frmUnPlanned.BindingData.UnplannedViewCollection)
            {
                foreach (var unPlanedView in accountView.Services)
                {
                    if (unPlanedView.IsChecked)
                    {
                        try
                        {
                            int    accountID   = unPlanedView.AccountID;
                            string serviceName = unPlanedView.ServiceName;
                            Dictionary <string, string> options;
                            options = unPlanedView.Options;
                            options["ConflictBehvior"] = unPlanedView.ConflictBehvior.ToString();
                            if (!string.IsNullOrEmpty(unPlanedView.ServiceToRun))
                            {
                                options["ServiceToRun"] = unPlanedView.ServiceToRun;
                            }

                            if (unPlanedView.UseTargetPeriod)
                            {
                                if (_from.SelectedDate.Value > _to.SelectedDate.Value)
                                {
                                    throw new Exception("From Date can not be greater then to date");
                                }
                                DateTimeRange daterange = new DateTimeRange()
                                {
                                    Start = new DateTimeSpecification()
                                    {
                                        BaseDateTime = _from.SelectedDate.Value,
                                        Hour         = new DateTimeTransformation()
                                        {
                                            Type = DateTimeTransformationType.Exact, Value = 0
                                        },
                                    },
                                    End = new DateTimeSpecification()
                                    {
                                        BaseDateTime = _to.SelectedDate.Value,
                                        Hour         = new DateTimeTransformation()
                                        {
                                            Type = DateTimeTransformationType.Max
                                        },
                                    }
                                };
                                options.Add(PipelineService.ConfigurationOptionNames.TargetPeriod, daterange.ToAbsolute().ToString());
                            }


                            _schedulingCommunication.AddUnplanedService(accountID, serviceName, options, DateTime.Now);
                        }
                        catch (Exception ex)
                        {
                            throw;
                        }
                    }
                }
            }
            if (errors.Length == 0)
            {
                MessageBox.Show("All Services Added Successfuly");
            }
            else
            {
                MessageBox.Show("Not all services added successfully:\n" + errors.ToString());
            }
        }