It's an idiom, if you say that something/someone has said or done takes the cake, you mean that it was very bad, and even worse than things they have said or done before. for instance: She opend my mail, that really takes the cake !
New words, one handy idiom, and a 2-minute quiz — delivered to your inbox to keep your streak alive.
(http://www.merriam-webster.com/dictionary/take%20the%20cake: Merriam-Webster)
take the cake : to carry off the prize : rank first
Carry off the