internal static bool RegisterProtocol(Protocol pd, List <RawView> passportsRawView, UserSession Session, CardData TemplateCard, Folder PassportFolder, CardData refUniversal, out string TextResult)
        {
            TextResult = "";
            logger.Debug("Search passport...");

            var rw = passportsRawView.Find(ir => Regex.IsMatch(ir.Description,
                                                               pd.RegexPatternUnit, RegexOptions.IgnoreCase));

            if (rw != null)
            {
                logger.Debug("Паспорт найден для: {0}", pd.PhysicalFile.Name);
                TextResult = TextResult + "Паспорт найден для: " + pd.PhysicalFile.Name + "\n";
                var      value = rw.InstanceId.Value;
                CardData card  = Session.CardManager.GetCardData(value);
                card.AttachDocumentToCard(Session, pd);
                logger.Info("Загружен {0}", pd.PhysicalFile.Name);
                TextResult = TextResult + "Загружен " + pd.PhysicalFile.Name + "\n";
                return(true);
            }
            else
            {
                logger.Info("Паспорт не найден для '{0}'", pd.PhysicalFile.Name);
                TextResult = TextResult + "Паспорт не найден для " + pd.PhysicalFile.Name + "\n";
                if (SearchParty(Session, pd, refUniversal) != null)
                {
                    //CreateUnitCard(Session, pd, passportsRawView, TemplateCard, PassportFolder, refUniversal);
                    //logger.Info("Загружен {0}", pd.PhysicalFile.Name);
                    //TextResult = TextResult + "Загружен " + pd.PhysicalFile.Name + "\n";
                    //return true;
                    return(false);
                }
                else
                {
                    logger.Info("Партия не найдена для прибора: {0}", pd.PhysicalFile.Name);
                    TextResult = TextResult + "Партия не найдена для прибора: " + pd.PhysicalFile.Name + "\n";
                    return(false);
                }
            }
        }