Copy data between each other by keys

Let me rephrase then

I possess the following object and need to remove any elements(wProductVariations.attributes) from wProductVariations that do not match the attributes object at the root level:

{
  "attributes": [
    {
      "id": 1,
      "option": "SMALL"
    },
    {
      "id": 2,
      "option": "White"
    }
  ],
  "wProductVariations": [
    {
      "id": 2237,
      "attributes": [
        {
          "id": 1,
          "option": "XX-Large"
        },
        {
          "id": 2,
          "option": "White"
        }
      ],
      "menu_order": 0,
      "meta_data": [
        {
          "id": 56685,
          "key": "_wc_additional_variation_images",
          "value": ""
        }
      ]
    },
    {
      "id": 2236,
      "attributes": [
        {
          "id": 1,
          "option": "X-Large"
        },
        {
          "id": 2,
          "option": "White"
        }
      ]
    },
    {
      "id": 2235,
      "attributes": [
        {
          "id": 1,
          "option": "Large"
        },
        {
          "id": 2,
          "option": "White"
        }
      ]
    },
    {
      "id": 2234,
      "attributes": [
        {
          "id": 1,
          "option": "Medium"
        },
        {
          "id": 2,
          "option": "White"
        }
      ]
    },
    {
      "id": 2233,
      "attributes": [
        {
          "id": 1,
          "option": "Small"
        },
        {
          "id": 2,
          "option": "White"
        }
      ]
    }
  ]
}

hope this is clear now? Thanks in advance