When you realize you've done something wrong, admit it.  Don't blame others, even if they had a role...but take the blame, then accept the consequences, learn...and move forward...like David did, who did things far worse than any of us.