John Ortberg said this quote

David is called a man after God's heart. This can be a little confusing when you get into his story, because he's guilty of adultery and murder and cover-up. He's a train wreck as a husband, and he's worse as a dad. But his heart belongs to God. His whole life is immersed in the presence and story of God. What lights him up is to serve God and love God, and when he mess up—and he does—he repents and wants to get right with God again.