The account in Samuel of David’s ascent to the throne parallels the story in Genesis of Judah’s rise to preeminence; both highlight the theme of moral failure and redemption.
Read more on TheTorah.com: http://thetorah.com/literary-parallels-bereishit-samuel/