private static async Task ReloadApplicationTask(IAppIdentifier appIdentifier)
        {
            using (IApp app = await _qlikSenseServer.AppAsync(appIdentifier, noVersionCheck: true))
            {
                Console.WriteLine("App with name {0} opened", appIdentifier.AppName);
                AsyncHandle reloadHandle = new AsyncHandle("reloadTask");

                // By setting mode parameter on reload you can affect the behaviour check the help for more information.
                // http://help.qlik.com/sense/2.1/en-US/apis/net%20sdk/html/M_Qlik_Engine_App_DoReload.htm
                // During the reload task you can cancel the reload by calling app.Session.Hub.CancelReload() you should also need to cancel the "reloadTask"
                try
                {
                    var reloadTask = app.DoReloadAsync(reloadHandle, OnReloaded);

                    bool doWork = true;
                    while (doWork)
                    {
                        var progress = await app.Session.Hub.GetProgressAsync(reloadHandle);

                        Console.WriteLine("Progress: " + progress.TransientProgress + " Finished : " + progress.Finished);
                        if (progress.Finished)
                        {
                            doWork = false;
                        }

                        System.Threading.Thread.Sleep(1000);                         // Give the qlik engine time to work before we check the progress again.
                    }
                    await app.DoSaveAsync();

                    Console.WriteLine("App with name {0} saved and last reloaded {1}", appIdentifier.AppName, (await app.GetAppLayoutAsync()).LastReloadTime);
                }
                catch (TimeoutException e)
                {
                    // We got a timeout exception from the SDK, handle this should be handled. In this example will just cancel the reload in the engine and igonre it.
                    app.Session.Hub.CancelReload();
                }
            }
        }