Added template for running asynchronous code synchronously.