public override void TemplateValidation(int invoiceId, IGatherData gatherData, int format)
        {
            try
            {
                var template = gatherData.GetCustomerInvoiceGroupsTemplateData(invoiceId, format);

                var invoiceTemplate = new InvoiceTemplate();
                if (format == 4 || format == 3)
                {
                    if (template.CreditNoteTemplateIdMail == null)
                    {
                        throw new CreditNoteTemplateIdNotSet();
                    }

                    invoiceTemplate = gatherData.GetInvoiceTemplate((int)template.CreditNoteTemplateIdMail);
                }

                if (format == 5 || format == 3)
                {
                    if (template.CreditNoteTemplateIdPrint == null)
                    {
                        throw new CreditNoteTemplateIdNotSet();
                    }

                    invoiceTemplate = gatherData.GetInvoiceTemplate((int)template.CreditNoteTemplateIdPrint);
                }

                var invoiceTemplateFound = gatherData.ValidateTemplate(invoiceTemplate);
                if (!invoiceTemplateFound)
                {
                    throw new FileNotFoundException("The invoice template could not be found");
                }
            }
            catch (Aspose.Words.UnsupportedFileFormatException ex)
            {
                LogError(ex);
                throw;
            }
            catch (Exception ex)
            {
                LogError(ex);
                throw;
            }
        }
        public override void TemplateValidation(int invoiceId, IGatherData gatherData, int format)
        {
            var template = gatherData.GetCustomerInvoiceGroupsTemplateData(invoiceId, format);

            if (template.SpecificationTemplateIdMail == null)
            {
                throw new InvoiceTemplateIdNotSet();
            }

            var specificationTemplate = gatherData.GetInvoiceTemplate((int)template.SpecificationTemplateIdMail);

            var specificationTemplateFound = gatherData.ValidateTemplate(specificationTemplate); //Get InvoiceTemplateById

            if (!specificationTemplateFound)
            {
                throw new FileNotFoundException("The specification template could not be found");
            }
        }