Though it's a difficult situation to go through, still, one first needs to acknowledge this reality. Taking a pause and reassessing the situation from all aspects will be required. This has to be taken as a learning experience and accordingly a resolve to make the necessary changes will help in the long run. Lastly one should leave the organisation on a good note. A professional approach in dealing with this process really helps.