public override void Validate() { base.Validate(); var dupRole = Roles.FirstOrDefault(i => AllRoles.Any(r => r != i && r.Name.EqualsIgnoreCase(i.Name))); if (dupRole != null) { throw new DuplicatedException(dupRole.Name); } var dupGroup = Groups.FirstOrDefault(i => AllGroups.Any(r => r != i && r.Name.EqualsIgnoreCase(i.Name))); if (dupRole != null) { throw new DuplicatedException(dupRole.Name); } }