Embrace these moments. Show them your struggles. When parents display their human vulnerable side, this gives kids an opportunity to show their strengths. To forgive is a powerful teacher. No matter how consistent we are, no matter how well we have demonstrated our beliefs, the reality is, that one day our kids will behave in a manner that is less than acceptable.
Children often challenge their parents.
Try to keep your wits about you, continue to set firm yet reasonable limits, with firm and reasonable consequences. Most importantly, forgive them and love them despite their mistakes.