David’s blunders

David was a man after God’s own heart. However, he blundered several times, violating the Law of God. Was he ignorant about the Law or was disobedient to the commandments of God?
1) Census: David commanded Joab to take the census of Israel. However, Joab was not willing and asked him not to do that. Yet, David’s order prevailed. It resulted in the death of seventy thousand people. (II Samuel 24) If census is taken, ransom must be paid, if not plague would affect people. (Exodus 30:12)
2) Ark of Covenant: David tried to bring the Ark of Covenant without proper planning and preparation. Only the Levites should carry the Ark on their shoulders. But David brought the Ark on a cart. When Uzzah tried to steady the ark as he thought it would fall because the oxen stumbled. He was killed.
3) Marriage: The Bible teaches monogamy. However, David took many wives. Also, he committed adultery with Bathsheba, who was the wife of Uriah. He also murdered Uriah. He clearly violated at least three of the Ten Commandments. He coveted, committed adultery, and murdered.
4) Parenting: David did not follow the principles of parenting as taught by Moses. “You shall teach them diligently to your children and shall talk of them when you sit in your house, and when you walk by the way, and when you lie down, and when you rise.” (Deuteronomy 6:7)
5) No Law teachers: David developed the Nation of Israel as a powerful kingdom politically. He organised the Levites, priests, and musicians. (I Chronicles 23,24, 25) He even gathered material for building a huge Temple that would be later built by his son Solomon. With great pains I have provided for the house of the Lord 100,000 talents of gold, a million talents of silver, and bronze and iron beyond weighing, for there is so much of it; timber and stone, too, I have provided. To these you must add. (I Chronicles 22:14) Even today many leaders are erecting buildings, organising musicians, but not teaching the bible.
Do I diligently learn and obey the Lord?