private static void ImportCountries(JToken countryObj)
        {
            var context = new MoviesContext();
            var country = new Country();

            country.Name = countryObj["name"].Value<string>();

            context.Countries.Add(country);
            context.SaveChanges();
        }
        private static void ImportMovies(JToken movieObj)
        {
            var context = new MoviesContext();
            var movie = new Movie();

            movie.Isbn = movieObj["isbn"].Value<string>();
            movie.Title = movieObj["title"].Value<string>();
            movie.AgeRestriction = (AgeRestriction)Enum.Parse(typeof(AgeRestriction),
                movieObj["ageRestriction"].ToString());
            context.Movies.Add(movie);
            context.SaveChanges();
        }
        private static void ImportMovieRatings(JToken elementObj)
        {
            var context = new MoviesContext();

            string userName = elementObj["user"].Value<string>();
            string movie = elementObj["movie"].Value<string>();
            int stars = int.Parse(elementObj["rating"].ToString());

            context.Ratings.Add(new Rating()
            {
                Stars = stars,
                MovieId = context.Movies.FirstOrDefault(m => m.Isbn == movie).Id,
                UserId = context.Users.FirstOrDefault(u => u.UserName == userName).Id
            });

            context.SaveChanges();
        }
        private static void ImportFavouriteMovies(JToken favouriteMovieObj)
        {
            var context = new MoviesContext();

            string userName = favouriteMovieObj["username"].Value<string>();
            var dbUser = context.Users.FirstOrDefault(u => u.UserName == userName);

            Console.WriteLine("User {0} movies imported: ", favouriteMovieObj["username"].Value<string>());
            var moviesIsbn = JArray.Parse(favouriteMovieObj["favouriteMovies"].ToString());

            foreach (var movie in moviesIsbn)
            {
                string currMovie = movie.ToString();
                Movie newMovie = context.Movies.FirstOrDefault(m => m.Isbn == currMovie);
                dbUser.Movies.Add(newMovie);
                Console.WriteLine(newMovie.Title);
            }

            context.SaveChanges();
        }
        private static void ImportUsers(JToken userObj)
        {
            var context = new MoviesContext();
            var user = new User();

            user.UserName = userObj["username"].Value<string>();

            if (userObj["age"].Type != JTokenType.Null)
            {
                user.Age = userObj["age"].Value<int>();
            }

            if (userObj["email"].Type != JTokenType.Null)
            {
                user.Email = userObj["email"].Value<string>();
            }

            if (userObj["country"].Type != JTokenType.Null)
            {
                var countryName = userObj["country"].Value<string>();
                user.Country = context.Countries.FirstOrDefault(c => c.Name == countryName);
            }

            context.Users.Add(user);
            context.SaveChanges();
        }