/// <summary>
        /// Initializes delegate which used for multiple Sales Invoices creation in batch sample.
        /// </summary>
        protected Func<int, SalesInvoiceCreditNoteDto> GetSalesInvoiceGeneratorForBatchCreation()
        {
            VatTypeDto vatType = ApiClientProvider.Default.VatTypes.OtherEU;
            CustomerDto[] customers = ApiClientProvider.Default.Customers.GetPage().Items;
            ProductDto[] products = ApiClientProvider.Default.Products.GetPage().Items;

            VatCategoryDto salesVatCategory = ApiClientProvider.Default.VatCategories.Sales;
            Dictionary<decimal, VatRateDto> vatRates = ApiClientProvider.Default.VatRates.GetPageByVatCategory(salesVatCategory.id).Items.ToDictionary(vatRate => vatRate.percentage);

            CategoryTypeDto salesCategoryType = ApiClientProvider.Default.CategoryTypes.Sales;
            AnalysisCategoryDto[] analysisCategories = ApiClientProvider.Default.AnalysisCategories.GetPageByCategoryType(salesCategoryType.id).Items;
            UserDefinedFieldDto[] userDefinedFields = ApiClientProvider.Default.UserDefinedFields.GetPageByCategoryType(salesCategoryType.id).Items;

            return index =>
            {
                SalesInvoiceGenerationParameters parameters = new SalesInvoiceGenerationParameters
                {
                    EntryDate = SalesInvoiceEntryDate,
                    VatTypeId = vatType.id,
                    CustomerId = customers[index % customers.Length].id,
                    ProductId = products[index % products.Length].id,
                    VatRates = vatRates,
                    AnalysisCategories = analysisCategories,
                    UserDefinedFields = userDefinedFields
                };
                return SampleDtoGenerator.GenerateSalesInvoice(parameters);
            };
        }
 public static SalesInvoiceCreditNoteDto GenerateSalesInvoice(SalesInvoiceGenerationParameters parameters)
 {
     return new SalesInvoiceCreditNoteDto
     {
         customerId = parameters.CustomerId,
         procDate = parameters.EntryDate.AddDays(5),
         entryDate = parameters.EntryDate,
         note = "note",
         details = "details",
         ourReference = "or",
         yourReference = "yr",
         total = 82.5m,
         totalVAT = 12.5m,
         loType = "1",
         vatTypeId = parameters.VatTypeId,
         deliveryTo = new[] { "dt_1", "dt_2" },
         productTrans = new ProductTranDto[]
         {
             new ProductTranDto
             {
                 unitPrice = 10,
                 quantity = 3,
                 vatRateId = parameters.VatRates[15].id,
                 productId = parameters.ProductId,
                 tranNotes = new[] { "tn_1_1", "tn_1_2" },
                 acEntries = new AcEntryDto[]
                 {
                     new AcEntryDto
                     {
                         accountCode = parameters.AnalysisCategories[0].accountCode,
                         analysisCategoryId = parameters.AnalysisCategories[0].id,
                         value = 20m
                     },
                     new AcEntryDto
                     {
                         accountCode = parameters.AnalysisCategories[1].accountCode,
                         analysisCategoryId = parameters.AnalysisCategories[1].id,
                         value = 10m
                     }
                 },
             },
             new ProductTranDto
             {
                 unitPrice = 20,
                 quantity = 2,
                 vatRateId = parameters.VatRates[20].id,
                 tranNotes = new[] { "tn_2_1", "tn_2_2" },
                 acEntries = new AcEntryDto[]
                 {
                     new AcEntryDto
                     {
                         accountCode = parameters.AnalysisCategories[0].accountCode,
                         analysisCategoryId = parameters.AnalysisCategories[0].id,
                         value = 40m
                     }
                 }
             }
         },
         customFields = new UserDefinedFieldValueDto[]
         {
             new UserDefinedFieldValueDto
             {
                 userDefinedFieldId = parameters.UserDefinedFields[0].id,
                 value = "field_1"
             },
             new UserDefinedFieldValueDto
             {
                 userDefinedFieldId = parameters.UserDefinedFields[1].id,
                 value = "field_2"
             }
         }
     };
 }