Update to MVC 4 and add code from old package

I had lost the original source. So I extracted this from the NuGet
package.