refactored code to save the transcripts into mongodb