private void CheckExists()
        {
            using (Deployment.Group btsGroup = new Deployment.Group())
            {
                try
                {
                    btsGroup.DBName   = this.Database;
                    btsGroup.DBServer = this.DatabaseServer;

                    Deployment.Application btsApplication = btsGroup.Applications[this.Application];
                    btsApplication.Log    += this.DeploymentLog;
                    btsApplication.UILevel = 2;

                    if (this.Resources.Any(talkResource => !btsApplication.ResourceCollection.ToList().Exists(r => r.Luid == talkResource.FullName)))
                    {
                        this.Exists = false;
                        return;
                    }

                    this.Exists = true;
                }
                catch
                {
                    btsGroup.Abort();
                    throw;
                }
            }
        }
        private void Remove()
        {
            // resources with dependencies must be removed first
            this.SortResources();

            foreach (BizTalkResource r in this.resources)
            {
                using (Deployment.Group btsGroup = new Deployment.Group())
                {
                    try
                    {
                        btsGroup.DBName   = this.Database;
                        btsGroup.DBServer = this.DatabaseServer;
                        Deployment.Application btsApplication = btsGroup.Applications[this.Application];
                        btsApplication.Log    += this.DeploymentLog;
                        btsApplication.UILevel = 2;
                        btsApplication.RemoveResource(string.Empty, r.FullName);
                    }
                    catch
                    {
                        btsGroup.Abort();
                        throw;
                    }
                }
            }
        }
        private void Add()
        {
            using (Deployment.Group btsGroup = new Deployment.Group())
            {
                try
                {
                    btsGroup.DBName   = this.Database;
                    btsGroup.DBServer = this.DatabaseServer;
                    Deployment.Application btsApplication = btsGroup.Applications[this.Application];
                    btsApplication.Log    += this.DeploymentLog;
                    btsApplication.UILevel = 1;

                    this.SortResources();
                    if (this.Gac)
                    {
                        // gac asssemblies
                        this.Resources.ForEach(r => this.AddAssembly(r));
                    }

                    this.Resources.ForEach(r => btsApplication.AddResource(r.ResourceType, r.FullName, r.Properties, this.Force));
                }
                catch
                {
                    btsGroup.Abort();
                    throw;
                }
            }
        }
        private void CheckExists()
        {
            using (Deployment.Group btsGroup = new Deployment.Group())
            {
                try
                {
                    btsGroup.DBName = this.Database;
                    btsGroup.DBServer = this.DatabaseServer;

                    Deployment.Application btsApplication = btsGroup.Applications[this.Application];
                    btsApplication.Log += this.DeploymentLog;
                    btsApplication.UILevel = 2;

                    if (this.Resources.Any(talkResource => !btsApplication.ResourceCollection.ToList().Exists(r => r.Luid == talkResource.FullName)))
                    {
                        this.Exists = false;
                        return;
                    }

                    this.Exists = true;
                }
                catch
                {
                    btsGroup.Abort();
                    throw;
                }
            }
        }
        private void Remove()
        {
            // resources with dependencies must be removed first
            this.SortResources();

            foreach (BizTalkResource r in this.resources)
            {
                using (Deployment.Group btsGroup = new Deployment.Group())
                {
                    try
                    {
                        btsGroup.DBName = this.Database;
                        btsGroup.DBServer = this.DatabaseServer;
                        Deployment.Application btsApplication = btsGroup.Applications[this.Application];
                        btsApplication.Log += this.DeploymentLog;
                        btsApplication.UILevel = 2;
                        btsApplication.RemoveResource(string.Empty, r.FullName);
                    }
                    catch
                    {
                        btsGroup.Abort();
                        throw;
                    }
                }
            }
        }
        private void Add()
        {
            using (Deployment.Group btsGroup = new Deployment.Group())
            {
                try
                {
                    btsGroup.DBName = this.Database;
                    btsGroup.DBServer = this.DatabaseServer;
                    Deployment.Application btsApplication = btsGroup.Applications[this.Application];
                    btsApplication.Log += this.DeploymentLog;
                    btsApplication.UILevel = 1;

                    this.SortResources();
                    if (this.Gac)
                    {
                        // gac asssemblies
                        this.Resources.ForEach(this.AddAssembly);
                    }

                    this.Resources.ForEach(r => btsApplication.AddResource(r.ResourceType, r.FullName, r.Properties, this.Force));
                }
                catch
                {
                    btsGroup.Abort();
                    throw;
                }
            }
        }