Israel Finkelstein and Neil Asher Silbermam--subtitled--In Search of the Roots of the Western Tradition
The earliest folklore and verses about David depict a bandit leader, hiding in the mountains, leading a small gang of traveling raiders( which fits what we know of the ninth century B.C.E.). That bandit may well be the "true" David. In latter periods, authors added images of David as a poet, as the founder of a great dynasty, as a political in-fighter, and (perhaps most famously) as a sinner. All of these images made sense for the authors that created them, and a similar evolution of Solomon from the builder of the Temple, to expander of his empire, to wise sage, to rich trader similarly reflects the successive stages of history up to the time of Jesus.
Ultimately, David and Solomon came to embody a tradition of divinely inspired kings and even messiahs, the forerunners of Jesus and the great kings of Europe throughout the Middle Ages.