public void Create(RuleView ruleView, long structure,
                           IEnumerable<KeyValuePair<string, string>> pairServicePermissions)
        {
            if (ruleView == null) throw new ArgumentNullException("ruleView");
            if (pairServicePermissions == null) throw new ArgumentNullException("pairServicePermissions");

            var rule = ruleView.Convert();

            var structureObj = StructureManager.Get(_dbContext, structure);
            if (structureObj == null) throw new ArgumentException("\"structure\" is a invalid argument");

            rule.Structure = structureObj;

            foreach (var pairServicePermission in pairServicePermissions)
            {
                var servicePermissionObj = ServiceManager.GetPermission(_dbContext, pairServicePermission.Key,
                                                                        pairServicePermission.Value);
                if (servicePermissionObj == null)
                    throw new ArgumentException(
                        String.Format("The Service Permission {0} {1} is a invalid argument",
                                      pairServicePermission.Key,
                                      pairServicePermission.Value)
                        );

                //TO DO verify is rule. permissions contains servicePermission
                rule.Permissions.Add(servicePermissionObj);
            }

            _dbContext.Rules.Add(rule);

            _dbContext.SaveChanges();
        }
        public void Create(RuleView ruleView, long structure)
        {
            if (ruleView == null) throw new ArgumentNullException("ruleView");

            var rule = ruleView.Convert();

            var structureObj = StructureManager.Get(_dbContext, structure);
            if (structureObj == null) throw new ArgumentException("\"structure\" is a invalid argument");

            rule.Structure = structureObj;

            _dbContext.Rules.Add(rule);

            _dbContext.SaveChanges();
        }