/// <summary>
        /// Add method.
        /// </summary>
        /// <param name="dto"></param>
        /// <returns></returns>
        public Order Save(Order dto)
        {
            Order update;
            bool  needOrderNumber = false;

            if (dto.Id > 0)
            {
                update = orderDAC.FindById <Order>(dto.Id);
            }
            else
            {
                update = new Order {
                    CreatedOn = DateTime.Now, CreatedBy = dto.CreatedBy, Rowid = Guid.NewGuid()
                };
                needOrderNumber = true;
            }

            if (dto.ClientId <= 0)
            {
                throw new BusinessException("b.validation.order.clientId.invalid");
            }
            if (clientBusiness.Find(dto.ClientId) == null)
            {
                throw new BusinessException("b.validation.order.clientId.missing");
            }

            update.ClientId = dto.ClientId;

            update.State = dto.State < 0 ? throw new BusinessException("b.validation.order.productId.missing") : dto.State;

            update.OrderDate = dto.OrderDate;

            update.ChangedOn = DateTime.Now;
            update.ChangedBy = dto.ChangedBy;
            var saved = orderDAC.Save(update);

            if (needOrderNumber)
            {
                OrderNumber number = new OrderNumber();
                number.CreatedBy = update.CreatedBy;
                number.CreatedOn = update.CreatedOn;
                number.ChangedBy = update.ChangedBy;
                number.ChangedOn = update.ChangedOn;

                number.Number = saved.Id;

                number = orderNumberDAC.Save(number);

                saved.OrderNumber = number.Number;

                saved = orderDAC.Save(update);
            }

            return(saved);
        }