public void PostInvoiceRecalculating(Entity targetInvoice) { var fact = targetInvoice.GetAttributeValue <bool?>(Common.Entities.nav_invoice.Fields.nav_fact); if (fact == true) { var agreementService = new AgreementService(_service, _tracingService); _tracingService.Trace("Set nav_type value"); agreementService.RecalculateFactSummaAfterPayingInvoice(targetInvoice); _service.Delete(targetInvoice.LogicalName, targetInvoice.Id); } }