I think initially walking away is the best move, while "walked away" you learn what it takes to calm down. Maybe you are able to deep breathe, step away from the situation and look at it rationally etc .. Over time you will see a pattern appear that you can follow . So maybe the next "situation" comes up and you can automatically mentally take a step back and not allow yourself to lose control.. It takes practice and its not 100% but it can help a lot.