Added tests and saving to mongo after instance merge