Sayyiduna Zubair bin Al-Awwam (may Allah be pleased with him) says: O Messenger of Allah! When we leave your presence, we begin to talk about matters of ignorance. The Prophet (peace and blessings be upon him) said: "When you sit in such gatherings from which you fear for your souls, then at the time of leaving, recite this supplication: «سُبْحَانَكَ اللّٰهُمَّ وَبِحَمْدِكَ نَشْهَدُ أَنْ لَا إِلٰهَ إِلَّا أَنْتَ نَسْتَغْفِرُكَ وَنَتُوبُ إِلَيْكَ» By this, your sins that you have committed will be forgiven."