protected override void ProcessRecord()
        {
            base.ProcessRecord();

            using (GlymaConfiguration configuration = new GlymaConfiguration(Identity, this))
            {
                if (string.IsNullOrEmpty(configuration.SecurityDbName) || string.IsNullOrEmpty(configuration.SecurityDbServer))
                {
                    WriteWarning("The provided site doesn't have a valid Security database server or Security database name declared. Aborting securable context creation.");
                    return;
                }

                string connectionString = "Data Source=" + configuration.SecurityDbServer + ";Initial Catalog=" + configuration.SecurityDbName + ";Integrated Security=True";

                using (SecurityDatabaseDataContext dataContext = new SecurityDatabaseDataContext(connectionString))
                {
                    SecurableContext securableContext = new SecurableContext();
                    securableContext.SecurableContextName = SecurableContextName;
                    securableContext.SecurableContextUid  = Guid.NewGuid();
                    securableContext.SiteSPID             = configuration.Site.ID;

                    dataContext.SecurableContexts.InsertOnSubmit(securableContext);
                    dataContext.SubmitChanges();

                    SPPropertyBag properties = configuration.SecurityWeb.Properties;

                    properties["Glyma.SecurableContextId"] = securableContext.SecurableContextId.ToString();
                    properties.Update();
                    configuration.SecurityWeb.Update();
                }
            }
        }
        protected override void ProcessRecord()
        {
            base.ProcessRecord();

            using (GlymaConfiguration configuration = new GlymaConfiguration(Identity, this))
            {
                if (string.IsNullOrEmpty(configuration.SecurityDbName) || string.IsNullOrEmpty(configuration.SecurityDbServer))
                {
                    WriteWarning("The provided site doesn't have a valid Security database server or Security database name declared. Aborting securable context creation.");
                    return;
                }

                string connectionString = "Data Source=" + configuration.SecurityDbServer + ";Initial Catalog=" + configuration.SecurityDbName + ";Integrated Security=True";

                using (SecurityDatabaseDataContext dataContext = new SecurityDatabaseDataContext(connectionString))
                {
                    SecurableContext securableContext = new SecurableContext();
                    securableContext.SecurableContextName = SecurableContextName;
                    securableContext.SecurableContextUid = Guid.NewGuid();
                    securableContext.SiteSPID = configuration.Site.ID;

                    dataContext.SecurableContexts.InsertOnSubmit(securableContext);
                    dataContext.SubmitChanges();

                    SPPropertyBag properties = configuration.SecurityWeb.Properties;

                    properties["Glyma.SecurableContextId"] = securableContext.SecurableContextId.ToString();
                    properties.Update();
                    configuration.SecurityWeb.Update();
                }
            }
        }