adding logic to make sure resultparameters is in the correct nested array format so the extend calls merge data into the right levels