LPS-50238 Added recursion to handle nested fields