David was very human and made some serious mistakes in his life, but the key that made him a "man after God's own heart" was his willingness to acknowledge his sins, humbly ask for forgiveness, and really repent and strive to follow God. We all make mistakes, but the Bible gives us assurance that if we are truly sorry for our sins, God will forgive us. Once forgiven, we should strive to not repeat our mistakes.