David’s life was filled with mistake after mistake. Yet God felt David’s heart was right. (1 Samuel 13:14, 1 Samuel 16:7, 1 Kings 11:4,1 Kings 14:8, 1 Kings 15:3, Acts 13:22) When David sinned he would cry out to God forgive me, make me pure, wash me (Psalms 51:1-19). David prayed to God when his enemies attacked (Psalm 3:1-8, Psalm 109:1-31) and David knew where his strength came from (Psalm 18:1, 28:7, 59:16-17). God forgives and overlooks our sin when we worship Him through the Son. When we accept Jesus as Lord and savior then we like David are washed as white as snow.
I have been reading through 1 and 2 Samuel lately. The life of David is such an amazing representation of who we are in Christ. David constantly goofed. He committed adultery (2 Samuel 11:4) and murder to cover it up (2 Samuel 11:15). He almost murdered a man because the man would not give him something to eat (1 Samuel 25:33). He had a census (2 Samuel 24:2) taken knowing that God did not want him to. He did a poor job raising his children. One son raped David’s daughter (2 Samuel 13:11-14) another murdered his own brother (2 Samuel 13:28) and tried to take the kingdom from David (2 Samuel 15:10).