Memory Consumption in Requests

My use case is something like this example. But, the real case is, I receive a bill and this bill has your own fields and some fields to be copied inside the installments.

bill: %{
    fields,
    installments: [%{amount: 100}, %{amount: 100}, %{amount: 1000}]
}

From Bill I have to copy 5 fields to inside each installment object and another 12 fields I should copy if the installment object does not has these fields filled.

I could receive 20 installments, or maybe 50… and this proccess could take a long request time.
I would have to map each installment, copy the fields and verify if I should copy some fields from bill or not.