/// <summary>
 /// Run an async function ensuring that HttpContext won't be null on the way
 /// </summary>
 /// <param name="context">The current HttpContext</param>
 /// <param name="func">The function to run</param>
 /// <param name="preparing">A method to run while preparing to run the async function</param>
 /// <param name="running">A method to run while running the async function</param>
 public static void Run(this HttpContext context, Func <Task> func, Action <AsyncCallContext> preparing = null, Action <AsyncCallContext> running = null)
 {
     context.Run <object>(async() =>
     {
         await func();
         return(null);
     }, preparing, running);
 }