Code from web api tutorial.