/// <summary>
        /// Отзыв платежного документа
        /// </summary>
        /// <param name="dto"></param>
        /// <returns></returns>
        private importPaymentDocumentRequestWithdrawPaymentDocument RevokeDocument(PaymentDocumentDto dto)
        {
            var document = new importPaymentDocumentRequestWithdrawPaymentDocument {
                TransportGUID     = dto.TransportGuid,
                PaymentDocumentID = dto.UniqueNumber
            };

            return(document);
        }
        /// <summary>
        /// Платежный документ
        /// </summary>
        /// <returns></returns>
        private importPaymentDocumentRequestPaymentDocument PaymentDocument(bool usedSpecialCapRepair, PaymentDocumentDto dto, string paymentInformationKey)
        {
            var document = new importPaymentDocumentRequestPaymentDocument {
                TransportGUID = dto.TransportGuid,
                AccountGuid   = dto.AccountGUID,

                Item            = true,
                ItemElementName = ItemChoiceType4.Expose,

                PaymentInformationKey = paymentInformationKey,

                // Авансы
                AdvanceBllingPeriodSpecified = false,

                //Долг
                DebtPreviousPeriodsSpecified = false,

                //Итог к оплате с учетом рассрочек и.т.п.
                totalPiecemealPaymentSumSpecified           = false,
                TotalByPenaltiesAndCourtCostsSpecified      = false,
                TotalPayableByChargeInfoSpecified           = false,
                TotalPayableByPDWithDebtAndAdvanceSpecified = false,
                TotalPayableByPDSpecified = false,

                PaidCashSpecified = false,
                DateOfLastReceivedPaymentSpecified = false
            };

            if (dto.DebtPreviousPeriods > 0)
            {
                document.DebtPreviousPeriodsSpecified = true;
                document.DebtPreviousPeriods          = dto.DebtPreviousPeriods;
            }

            if (dto.DateOfLastPay.HasValue)
            {
                document.PaidCashSpecified = true;
                document.PaidCash          = dto.Pay;
                document.DateOfLastReceivedPaymentSpecified = true;
                document.DateOfLastReceivedPayment          = dto.DateOfLastPay.Value;
            }

            var charges = new List <object>();

            if (dto.ChargesInfos.Any())
            {
                charges.AddRange(dto.ChargesInfos.Select(charge => ChargeInfo(charge)).ToArray());

                // в случае наличия спец.счета кап.ремонта
                if (usedSpecialCapRepair && dto.CapitalRepairs?.Count() == 0)
                {
                    charges.Add(new CapitalRepairImportType {
                    });
                }
            }
            ;

            if (dto.CapitalRepairs.Any())
            {
                charges.AddRange(dto.CapitalRepairs.Select(x => new CapitalRepairImportType {
                    Contribution          = x.Contribution,
                    AccountingPeriodTotal = x.AccountingPeriodTotal,
                    MoneyRecalculation    = x.Recalcultion,
                    TotalPayable          = x.Total
                }).ToArray());
            }

            if (dto.Penies.Any())
            {
                charges.Add(new PaymentDocumentTypePenaltiesAndCourtCosts {
                    Cause       = dto.Penies.FirstOrDefault().Clause,
                    ServiceType = dto.Penies.Select(x => new nsiRef {
                        Code = x.Code, GUID = x.Guid
                    }).FirstOrDefault(),
                    TotalPayable = dto.Penies.Sum(x => x.Total)
                });
            }

            document.Items = charges.ToArray();
            return(document);
        }