private static void CreateGame(DiabloEntities context, IEnumerable<XElement> xGames, User user)
        {
            foreach (var xGame in xGames)
            {
                // Find the team by team name and country name (if exists)
                var gameName = xGame.Element("game-name").Value;
                var charName = xGame.Element("character").Attribute("name").Value;
                var cash = xGame.Element("character").Attribute("cash").Value;
                var level = xGame.Element("character").Attribute("level").Value;
                var joinedOn = xGame.Element("joined-on").Value;

                decimal parsedCash = decimal.Parse(cash);
                int parsedLvl = int.Parse(level);
                DateTime newJoinedOnDate = DateTime.ParseExact(joinedOn, "dd/mm/yyyy", System.Globalization.CultureInfo.InvariantCulture);
                var game = context.Games.FirstOrDefault(g => g.Name == gameName);

                // Create the team if it does not exists
                if (game != null)
                {
                    Console.WriteLine("Existing game: {0}",
                        game.Name);
                }
                else
                {
                    // Create a new team in the DB
                    game = new Game()
                    {
                        Name = gameName
                    };
                    var character = new Character()
                    {
                        Name = charName

                    };
                    var usersGame = new UsersGame()
                    {
                        Cash = parsedCash,
                        Level = parsedLvl,
                        JoinedOn = newJoinedOnDate
                    };

                    context.Games.Add(game);
                    context.Characters.Add(character);
                    context.UsersGames.Add(usersGame);
                    context.SaveChanges();
                    Console.WriteLine("Created game: {0}",
                        game.Name);
                }

            }
        }
        private static void CreateGame(DiabloEntities context, IEnumerable <XElement> xGames, User user)
        {
            foreach (var xGame in xGames)
            {
                // Find the team by team name and country name (if exists)
                var gameName = xGame.Element("game-name").Value;
                var charName = xGame.Element("character").Attribute("name").Value;
                var cash     = xGame.Element("character").Attribute("cash").Value;
                var level    = xGame.Element("character").Attribute("level").Value;
                var joinedOn = xGame.Element("joined-on").Value;

                decimal  parsedCash      = decimal.Parse(cash);
                int      parsedLvl       = int.Parse(level);
                DateTime newJoinedOnDate = DateTime.ParseExact(joinedOn, "dd/mm/yyyy", System.Globalization.CultureInfo.InvariantCulture);
                var      game            = context.Games.FirstOrDefault(g => g.Name == gameName);

                // Create the team if it does not exists
                if (game != null)
                {
                    Console.WriteLine("Existing game: {0}",
                                      game.Name);
                }
                else
                {
                    // Create a new team in the DB
                    game = new Game()
                    {
                        Name = gameName
                    };
                    var character = new Character()
                    {
                        Name = charName
                    };
                    var usersGame = new UsersGame()
                    {
                        Cash     = parsedCash,
                        Level    = parsedLvl,
                        JoinedOn = newJoinedOnDate
                    };

                    context.Games.Add(game);
                    context.Characters.Add(character);
                    context.UsersGames.Add(usersGame);
                    context.SaveChanges();
                    Console.WriteLine("Created game: {0}",
                                      game.Name);
                }
            }
        }