public void Check(IEnumerable <ConversionProfile> profiles)
        {
            if (profiles == null)
            {
                throw new ArgumentNullException();
            }

            foreach (var settingsConversionProfile in profiles)
            {
                var orderCopy = settingsConversionProfile.ActionOrder.ToList();
                foreach (var entry in orderCopy)
                {
                    var type = _allowedTypes.FirstOrDefault(x => x.Name == entry);
                    if (type == null || !typeof(IProfileSetting).IsAssignableFrom(type))
                    {
                        settingsConversionProfile.ActionOrder.Remove(entry);
                    }
                }

                var list = new List <string>();
                CheckAllChildSettings(list, settingsConversionProfile);
                CheckSingleSetting(list, settingsConversionProfile.PdfSettings.Security);
                CheckSingleSetting(list, settingsConversionProfile.PdfSettings.Signature);
                var hasCorruptOrder = _actionOrderHelper.HasCorruptOrder(settingsConversionProfile);

                if (list.Count != settingsConversionProfile.ActionOrder.Count || hasCorruptOrder)
                {
                    settingsConversionProfile.ActionOrder = list;
                    _actionOrderHelper.ForceDefaultOrder(settingsConversionProfile);
                }
            }
        }
        public void Check(IEnumerable <ConversionProfile> profiles)
        {
            if (profiles == null)
            {
                throw new ArgumentNullException();
            }

            foreach (var settingsConversionProfile in profiles)
            {
                var orderCopy = settingsConversionProfile.ActionOrder.ToList();
                foreach (var entry in orderCopy)
                {
                    var type = _allowedTypes.FirstOrDefault(x => x.Name == entry);
                    if (type == null || !typeof(IProfileSetting).IsAssignableFrom(type))
                    {
                        settingsConversionProfile.ActionOrder.Remove(entry);
                    }
                }

                var enabledActionsList = GetListOfActiveActions(settingsConversionProfile);

                // get an action ordered list with only distinct and enabled actions
                var actionOrderList = settingsConversionProfile
                                      .ActionOrder
                                      .Distinct()
                                      .Where(s => enabledActionsList.Contains(s))
                                      .ToList();

                AddMissingActiveActions(actionOrderList, enabledActionsList);
                UpdateActionOrderList(settingsConversionProfile, actionOrderList);

                if (_actionOrderHelper.HasCorruptOrder(settingsConversionProfile))
                {
                    _actionOrderHelper.EnsureEncryptionAndSignatureOrder(settingsConversionProfile);
                }
            }
        }