King David stayed back from leading Bnei Yisrael into battle against Amon, went for a stroll on his rooftop and it was all downhill from there. In an act of sexual violation and bloodshed, David's whole life turns around. His punishment comes in the same manner, sexual violations and bloodshed, through his children. David in his greatness not only accepts his punishment, but welcomes it until the end of his life. He recognized the power he may have abused as a king and lost a part of his inner moral compass, making some very passive decisions, until the very end where Natan Hanavi and Batsheva convey the message that it's time to step up and appoint Shelomo as the heir to the throne.

Courtesy of www.tanachstudy.com