A recurring motif is generally used by writers to connect stories and characters to the past or suggest parallels. The Gospels and Acts are filled with them. An example of this is found at Acts, 2 Cor, 1 Sam and Joshua.
In Joshua 2 the King of Jericho seeks the Jewish spies but is saved by Rahab:
3 So the king of Jericho sent this message to Rahab: “Bring out the men who came to you and entered your house...15 So she let them down by a rope through the window, for the house she lived in was part of the city wall. 16 She said to them, “Go to the hills so the pursuers will not find you. Hide yourselves there three days until they return, and then go on your way.”
In 1 Sam 19 The Saul the King of Israel seeks David but is saved by Micah his wife:
11 Saul (the King) sent men to David’s house to watch it and to kill him in the morning. But Michal, David’s wife, warned him, “If you don’t run for your life tonight, tomorrow you’ll be killed.” 12 So Michal let David down through a window, and he fled and escaped.
In 2 Cor 11 the Nabatean King Aretus seeks to kill Saul but is saved by unnamed others:
32 In Damascus the ethnarch of Aretas the King was watching the city of the Damascenes, wishing to seize me, 33 and through a window in a rope basket I was let down, through the wall, and fled out of his hands.
In the Acts version/expansion of the story the enemy has shifted to "the Jews" and is saved by his followers:
23 After many days had gone by, there was a conspiracy among the Jews to kill him, 24 but Saul learned of their plan. Day and night they kept close watch on the city gates in order to kill him. 25 But his followers took him by night and lowered him in a basket through an opening in the wall.
Clearly the stories are intertextually related .
As a side note, I thought the rest of the David story interesting, David and his wife have a life size 'idol' in their home to slip into the bed to look like David. ???