static void Main()
        {
            BooksDAO booksDao = new BooksDAO();

            XmlDocument queryDocument = new XmlDocument();
            queryDocument.Load("../../simple-query.xml");

            string title = GetTitle(queryDocument);
            string author = GetAuthorName(queryDocument);
            string isbn = GetIsbn(queryDocument);

            IEnumerable<FoundBookTransferObject> foundBooksInfos = 
                booksDao.SearchBooks(title, author, isbn);
            int booksInfosCount = foundBooksInfos.Count();
            if (booksInfosCount != 0)
            {
                Console.WriteLine("{0} books found:", booksInfosCount);
                foreach (FoundBookTransferObject bookInfo in foundBooksInfos)
                {
                    int reviewsCount = bookInfo.ReviewsCount;
                    Console.WriteLine("{0} --> {1} reviews",
                        bookInfo.BookTitle, 
                        reviewsCount != 0 ? bookInfo.ReviewsCount.ToString() : "no");
                }
            }
            else
            {
                Console.WriteLine("Nothing found");
            }
        }
        static void Main()
        {
            Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;

            BooksDAO booksDao = new BooksDAO();
            SimpleBooksImport(booksDao, "../../simple-books.xml");

            ComplexBooksImport(booksDao, "../../complex-books.xml");
            Console.WriteLine("Importing books completed!");
        }
        static void ComplexBooksImport(BooksDAO booksDao, string xmlFilePath)
        {
            XmlDocument catalogDocument = new XmlDocument();
            catalogDocument.Load(xmlFilePath);
            string xPathBooksQuery = "/catalog/book";
            XmlNodeList bookNodesList = catalogDocument.SelectNodes(xPathBooksQuery);
            foreach (XmlNode bookNode in bookNodesList)
            {
                string title = GetInnerXml(bookNode, "title").Trim();

                IList<string> authorNames = new List<string>();
                GetAuthors(bookNode, authorNames);

                IList<ReviewTransferObject> reviewTransferObjects =
                    new List<ReviewTransferObject>();
                GetReviews(bookNode, reviewTransferObjects);

                string isbn = GetInnerXml(bookNode, "isbn");

                string webSite = GetInnerXml(bookNode, "web-site");
                if (webSite != null)
                {
                    webSite = webSite.Trim();
                }

                decimal? price = null;
                string priceAsString = GetInnerXml(bookNode, "price");
                if (priceAsString != null)
                {
                    price = decimal.Parse(priceAsString);
                }

                using (TransactionScope transcationScope = new TransactionScope(TransactionScopeOption.Required,
                    new TransactionOptions() { IsolationLevel = IsolationLevel.RepeatableRead }))
                {
                    booksDao.ComplexImportOfBook(authorNames, title, reviewTransferObjects, isbn, price, webSite);
                    transcationScope.Complete();
                }
            }
        }
        static void SimpleBooksImport(BooksDAO booksDao, string xmlFilePath)
        {
            XmlDocument catalogDocument = new XmlDocument();
            catalogDocument.Load(xmlFilePath);
            string xPathQuery = "/catalog/book";
            XmlNodeList bookNodesList = catalogDocument.SelectNodes(xPathQuery);
            foreach (XmlNode bookNode in bookNodesList)
            {
                string author = GetInnerXml(bookNode, "author").Trim();
                string title = GetInnerXml(bookNode, "title").Trim();
                string isbn = GetInnerXml(bookNode, "isbn");
                if (isbn != null)
                {
                    isbn = isbn.Trim();
                }

                string webSite = GetInnerXml(bookNode, "web-site");
                if (webSite != null)
                {
                    webSite = webSite.Trim();
                }

                decimal? price = null;
                string priceAsString = GetInnerXml(bookNode, "price");
                if (priceAsString != null)
                {
                    price = decimal.Parse(priceAsString);
                }

                booksDao.SimpleImportOfBook(author, title, isbn, price, webSite);
            }
        }