private async Task <Process> BuildProcess(string processId) { Process process = await _transactionStore.GetProcess(processId); var getContributionsRequest = new GetContributionsRequest { ProcessId = processId }; var contributions = await _transactionStore.GetContributions(getContributionsRequest); var donorContribution = contributions.Contributions.Find(contribution => contribution.Type != "Delivery"); var getDeliveryDemands = new GetDeliveryDemandsRequest { ProcessId = processId }; var deliveryDemands = await _transactionStore.GetDeliveryDemands(getDeliveryDemands); if (deliveryDemands.DeliveryDemands.Count != 0) { var deliveryDemand = deliveryDemands.DeliveryDemands[0]; contributions.Contributions.ForEach(contribution => { if (contribution.Type == "Delivery") { deliveryDemand.AddComponent(contribution); } }); process.AddComponent(deliveryDemand); } process.AddComponent(donorContribution); process.SetStore(_transactionStore); return(process); }