added save functionality that waits until the data has been inserted into mongo before refresh