How to fix corrupt Exchange mailbox

Basically, here is a complete guide on how to fix Corruption of Exchange server mailboxes  which occurs when a client incorrectly updates MAPI flags while processing the mailbox folder elements.