Eliminating duplicate code and handling conversion from HttpContext and HttpContextBase