There are some mistake we make as the children of God, we are always going to make mistakes, we are not perfect. God do not create us perfect.
People are willing to seek and desire God. In certain cases our lives reflects the living God. Although david was not first the fact that he had received some distortion made him a sinful soul. David spent most of the time with his father sheep serving where so he was choosing by God to be a shepherd to lead his people.
I do not receive that thing so in our life we need discipline, if you have to generate or do the will of God you need discipline everything so that we can able to carry the will of God, obey his commandment, do his will or every time.