Helper for storing objects in MongoDB