public static void UpdateFeatureSettings(dynamic model, AuthorizationSection section)
        {
            if (model == null)
            {
                throw new ApiArgumentException("model");
            }
            if (section == null)
            {
                throw new ArgumentNullException("section");
            }

            try {
                DynamicHelper.If <bool>((object)model.bypass_login_pages, v => section.BypassLoginPages = v);


                if (model.metadata != null)
                {
                    DynamicHelper.If <OverrideMode>((object)model.metadata.override_mode, v => section.OverrideMode = v);
                }
            }
            catch (FileLoadException e) {
                throw new LockedException(section.SectionPath, e);
            }
            catch (DirectoryNotFoundException e) {
                throw new ConfigScopeNotFoundException(e);
            }
        }
        public static Rule CreateRule(dynamic model, AuthorizationSection section)
        {
            if (model == null)
            {
                throw new ApiArgumentException("model");
            }

            RuleAccessType?accessType = DynamicHelper.To <RuleAccessType>(model.access_type);

            if (accessType == null)
            {
                throw new ApiArgumentException("access_type");
            }

            Rule rule = section.Rules.CreateElement();

            SetRule(rule, model);

            return(rule);
        }
        public static void DeleteRule(Rule rule, AuthorizationSection section)
        {
            if (rule == null)
            {
                return;
            }

            rule = section.Rules.FirstOrDefault(r => r.Users.Equals(rule.Users) &&
                                                r.Roles.Equals(rule.Roles) &&
                                                r.Verbs.Equals(rule.Verbs));

            if (rule != null)
            {
                try {
                    section.Rules.Remove(rule);
                }
                catch (FileLoadException e) {
                    throw new LockedException(section.SectionPath, e);
                }
                catch (DirectoryNotFoundException e) {
                    throw new ConfigScopeNotFoundException(e);
                }
            }
        }