Acts 13:22 And when he had removed him, he raised up David to be their king, of whom he testified and said, I have found in David the son of Jesse a man after my heart, who will do all my will.
Your complaint and argument is against God.
GOD is the one who called David a man after His own heart. Nobody made that up.
Maybe you need to re-read the article.
Or read it.
I read it. I notice how the author glossed over David’s flaws quickly moving on.