public static void RunBankRules(BankImport bankImport, IObjectSpace objectSpace)
        {
            var rules = objectSpace.GetObjects <BankImportRule>();

            foreach (var rule in rules)
            {
                ApplyBankRule(bankImport, rule);
            }
        }
        public static void SaveAndApplyRule(BankImport bankImport, BankImportRule rule)
        {
            try
            {
                var os = rule.ObjectSpace;
                os.CommitChanges();

                ApplyBankRule(bankImport, rule);
            }
            catch (Exception e)
            {
                throw;
            }

            bankImport.ObjectSpace.Refresh();
        }
        public static void ApplyBankRule(BankImport bankImport, BankImportRule rule)
        {
            foreach (var line in bankImport.Lines)
            {
                if (!MatchOK(line.Ref1, rule.Ref1))
                {
                    continue;
                }

                if (!MatchOK(line.Ref2, rule.Ref2))
                {
                    continue;
                }

                if (!MatchOK(line.Ref3, rule.Ref3))
                {
                    continue;
                }

                if (!MatchOK(line.Ref4, rule.Ref4))
                {
                    continue;
                }

                if (!MatchOK(line.Ref5, rule.Ref5))
                {
                    continue;
                }

                line.Account = line.ObjectSpace.GetObject(rule.ToAccount);

                if (line.Account != null)
                {
                    line.ObjectSpace.ModifiedObjects.Add(line);

                    Console.WriteLine(line.ObjectSpace.ModifiedObjects.Count);
                    line.ObjectSpace.CommitChanges();
                }
            }
        }