(Theoretical person gets caught doing something wrong) "I'm not the only one!" or better yet "It isn't as bad as what they are doing!"
When caught doing something you shouldn't be doing, it is only natural that we would get defensive. It is natural that we would try to minimize the effect of what we are doing wrong comparative to others. It would be like a husband caught cheating on his wife and then saying, yea, but my buddy does it all the time. It does not minimize what you have done at that moment to that person.
Accept responsibility, apologize, do whatever it takes to move forward and then work on not doing it again. I am not talking about affairs or gambling, or anything, but about everything.
And trust me, I can be the worst in trying to justify my every action, but I'm trying.