Persisting objects in MongoDB