private List <PXResult <JointPayeePayment> > GetJointPayeePaymentsAndJointPayees(APAdjust adjustment)
 {
     return(adjustment.AdjdDocType == APDocType.Invoice
         ? JointPayeePaymentDataProvider.GetJointPayeePaymentsAndJointPayees(graph, adjustment)
            .Where(x => x.GetItem <JointPayeePayment>().JointAmountToPay > 0).ToList()
         : new List <PXResult <JointPayeePayment> >());
 }
        private IEnumerable <PXResult <JointPayeePayment> > GetJointPayeePaymentsWithJointPayees(APRegister payment)
        {
            var insertedJointPayeePayments = Graph.Caches <JointPayeePayment>().Inserted.RowCast <JointPayeePayment>();
            var insertedJointPayeePaymentsAndJointPayees =
                insertedJointPayeePayments.Select(GetInsertedJointPayeePaymentsWithJointPayees);
            var jointPayeePaymentsAndJointPayees =
                JointPayeePaymentDataProvider.GetJointPayeePaymentsAndJointPayees(Graph, payment);

            return(jointPayeePaymentsAndJointPayees.Concat(insertedJointPayeePaymentsAndJointPayees).AsEnumerable()
                   .Where(DoesJointPayeeInternalIdMatchGenerationKey));
        }