/// <summary>
        /// Create a new game by passing in the game object
        /// POST api/games
        /// The method maps to POST because it starts with Post. We could explicitly set this method using the [httpPost] attribute
        /// </summary>
        /// <param name="game"></param>
        /// <returns></returns>
        public async Task<IHttpActionResult> PostGame(Game game)
        {
            if (!ModelState.IsValid)
            {
                return BadRequest(ModelState);
            }
            db.Games.Add(game);
            await db.SaveChangesAsync();

            return CreatedAtRoute("DefaultApi", new { id = game.Id }, new Models.DTO.Game(game));

        }
        /// <summary>
        /// Update a game by passing in the id of the game and the game object with the new values
        /// PUT api/games/1
        /// The method maps to PUT because it starts with Put. The method name format is Put[any name here]
        /// </summary>
        /// <param name="id"></param>
        /// <param name="game"></param>
        /// <returns></returns>
        public async Task<IHttpActionResult> PutGame (int id, Game game)
        {
            if(!ModelState.IsValid)
            {
                return BadRequest(ModelState);
            }
            if(id != game.Id)
            {
                return BadRequest();
            }

            db.Entry(game).State = System.Data.Entity.EntityState.Modified;
            await db.SaveChangesAsync();
            
            return StatusCode(HttpStatusCode.NoContent);
        }