you could simplify this by using ``array_replace_recursive`` as we are dealing with associative arrays everywhere