There is never a way to do the wrong thing and make it right. Wrong actions are wrong, no matter how you spin them.
When you do something wrong, there are thousands of ways to justify your actions, but none of those justifications will turn your wrong action into a right action.
On the other hand, you can do do the right thing in the wrong way.
Whether or not a good action is actually good, depends on both your intentions and the way that you carry out the act.
You can do the right thing, but do it in the wrong way or with bad intentions, just for appearances, and your good action suddenly isn't so honourable any more.
Make sure that you not only do the right thing, but that you do it with the right intentions, in the right way, and at the right time.
When your actions fulfilled each of these requirements, you can be assured that they are right and not just for show, or worse.
Always give thought to your actions before you act.