Recursively merge arrays