/// <summary>
        /// Parses <see cref="Customer"/> and <see cref="OrderedArticles"/>.
        /// </summary>
        /// <param name="document"></param>
        /// <param name="data"></param>
        /// <param name="database"></param>
        /// <returns></returns>
        public bool ParseAdditionalData(ref Biller.Core.Document.Document document, XElement data, Biller.Core.Interfaces.IDatabase database)
        {
            if (document is Offer)
            {
                var result = database.GetCustomer(data.Element("CustomerID").Value);
                var customer = result.Result;
                (document as Offer).Customer = customer;

                var articles = data.Element("OrderedArticles").Elements();
                (document as Offer).OrderedArticles.Clear();
                foreach (XElement article in articles)
                {
                    var temp = new Biller.Core.Articles.OrderedArticle();

                    var task = database.ArticleUnits();
                    temp.ArticleUnit = task.Result.Where(x => x.Name == article.Element("ArticleUnit").Value).Single();

                    var taskTaxClass = database.TaxClasses();
                    temp.TaxClass = taskTaxClass.Result.Where(x => x.Name == article.Element("TaxClass").Value).Single();

                    temp.ParseFromXElement(article);
                    (document as Offer).OrderedArticles.Add(temp);
                }

                try
                {
                    (document as Offer).PaymentMethode.ParseFromXElement(data.Element((document as Offer).PaymentMethode.XElementName));
                    (document as Offer).OrderShipment.ParseFromXElement(data.Element((document as Offer).OrderShipment.XElementName));
                } catch { }
                try
                {
                    (document as Offer).SmallBusiness = Boolean.Parse(data.Element("SmallBusiness").Value);
                    if ((document as Offer).SmallBusiness)
                        (document as Offer).OrderCalculation = new Calculations.SmallBusinessCalculation(document as Order.Order, true);
                    else if (!((document as Offer).OrderCalculation is Calculations.DefaultOrderCalculation))
                        (document as Offer).OrderCalculation = new Calculations.DefaultOrderCalculation(document as Order.Order, true);
                } catch { }
                try
                {
                    if (data.Element("EAddress") != null)
                    {
                        (document as Offer).DeliveryAddress.ParseFromXElement(data.Element("EAddress"));
                    }       
                } catch {}
            }
            else
            {
                return false;
            }
            return true;
        }
        /// <summary>
        /// Works with the <see cref="source"/> when <see cref="target"/> is type of <see cref="Order"/>.
        /// </summary>
        /// <param name="source">When source is type of <see cref="Biller.Core.Customers.Customer"/> or <see cref="Biller.Core.Articles.Article"/> the data will be passed to the target <see cref="Order.Order"/>.</param>
        /// <param name="target"><see cref="source"/> will be passed to <see cref="target"/> if it's type of <see cref="Order.Order"/>.</param>
        public void ReceiveData(object source, Biller.Core.Document.Document target)
        {
            if (target is Order.Order)
            {
                if (source is Biller.Core.Customers.Customer)
                {
                    (target as Order.Order).Customer = (source as Biller.Core.Customers.Customer);
                    (target as Order.Order).PaymentMethode = (source as Biller.Core.Customers.Customer).DefaultPaymentMethode;
                }

                if (source is Biller.Core.Articles.Article)
                {
                    if (target is Order.Order)
                    {
                        if (!String.IsNullOrEmpty((target as Order.Order).Customer.MainAddress.OneLineString))
                        {
                            //Check pricegroup
                            var customer = (target as Order.Order).Customer;
                            var orderedArticle = new Biller.Core.Articles.OrderedArticle(source as Biller.Core.Articles.Article);
                            orderedArticle.OrderedAmount = 1;
                            orderedArticle.OrderPosition = (target as Order.Order).OrderedArticles.Count + 1;

                            switch (customer.Pricegroup)
                            {
                                case 0:
                                    orderedArticle.OrderPrice = orderedArticle.Price1;
                                    break;
                                case 1:
                                    orderedArticle.OrderPrice = orderedArticle.Price2;
                                    break;
                                case 2:
                                    orderedArticle.OrderPrice = orderedArticle.Price3;
                                    break;
                            }
                            (target as Order.Order).OrderedArticles.Add(orderedArticle);

                        }
                        else
                        {
                            var orderedArticle = new Biller.Core.Articles.OrderedArticle(source as Biller.Core.Articles.Article);
                            orderedArticle.OrderedAmount = 1;
                            orderedArticle.OrderPrice = orderedArticle.Price1;
                            orderedArticle.OrderPosition = (target as Order.Order).OrderedArticles.Count + 1;
                            (target as Order.Order).OrderedArticles.Add(orderedArticle);
                        }
                    }
                }
            }
        }