private function recursiveApplyTransformationToArray(array $input, Transformation $transformation)
 {
     $result = [];
     $attributes = isset($input['@attributes']) ? $input['@attributes'] : [];
     // Strip out the attributes.
     unset($input['@attributes']);
     // Run the input against the transformation test. If it passes, run
     // the actual transformation
     if ($transformation->test($input, $attributes) === true) {
         $input = $transformation->action($input, $attributes);
     }
     // Are we dealing with an associative array, or a sequential indexed array
     $isAssoc = array_is_assoc($input);
     // Iterate over each element in the array and decide if we need to move deeper
     foreach ($input as $key => $value) {
         $next = is_array($value) ? $this->recursiveApplyTransformationToArray($value, $transformation) : $value;
         // Preserve array indexes
         $isAssoc ? $result[$key] = $next : array_push($result, $value);
     }
     return $result;
 }