// PUT /api/movies/5
        public Movie Put(Movie movie)
        {
            if (movie == null)
                throw new HttpResponseException(HttpStatusCode.NotFound);

            return _repository.CreateMovie(movie);
        }
        public Movie CreateMovie(Movie movie)
        {
            int index = _movies.FindIndex(x => x.Id == movie.Id);

            if (index < 0)
            {

                _movies.Add(movie);
                return movie;
            }
            else
            {
                throw new Exception("Movie already exists");
            }
        }
        public Movie UpdateMovie(Movie movie)
        {
            int index = _movies.FindIndex(x => x.Id == movie.Id);

            if (index < 0)
            {
                throw new Exception("Movie does not exist");
            }

            var item = _movies.FirstOrDefault(x => x.Id == movie.Id);
            if (item == null)
            {
                throw new Exception("Movie does not exist");
            }

            overWriteMovie(ref item, movie);
            _movies[index] = item; //this seems odd

            return item;
        }
        /// <summary>
        /// Helper for upddate movie
        /// </summary>
        /// <param name="cur"></param>
        /// <param name="newMovie"></param>
        private void overWriteMovie(ref Movie cur, Movie newMovie)
        {
            if (cur.Id != newMovie.Id) { throw new Exception("Movies do not match."); }

            cur.Rating = newMovie.Rating;
            cur.ReleaseDate = newMovie.ReleaseDate;
            cur.Director = newMovie.Director;
            cur.TagLine = newMovie.TagLine;
            cur.Title = newMovie.Title;
        }