public static bool UpdateUserGames(string username, List <Game> gamesToSet)
        {
            bool result = true;

            foreach (var game in gamesToSet)
            {
                if (game.IsOwned)
                {
                    GameAccessor.CreateUserGame(game.Id, username);
                }
                else
                {
                    GameAccessor.DeleteUserGame(game.Id, username);
                }
            }

            return(result);
        }
        public static bool CreateGame(Game game, string username = null, bool admin = false)
        {
            bool result = false;

            try
            {
                if (!string.IsNullOrEmpty(game.Publisher) && !PublisherManager.RetrievePublishers().Contains(game.Publisher.Trim()))
                {
                    if (!PublisherManager.CreatePublisher(game.Publisher, admin))
                    {
                        throw new ApplicationException("Publisher failed to write!");
                    }
                }
                if (!string.IsNullOrEmpty(game.Developer) && !DeveloperManager.RetrieveDevelopers().Contains(game.Developer.Trim()))

                {
                    if (!DeveloperManager.CreateDeveloper(game.Developer, admin))
                    {
                        throw new ApplicationException("Developer failed to write!");
                    }
                }
                if (!string.IsNullOrEmpty(game.Console) && !ConsoleManager.RetrieveConsoles().Contains(game.Console.Trim()))
                {
                    if (!ConsoleManager.CreateConsole(game.Console, admin))
                    {
                        throw new ApplicationException("Console failed to write!");
                    }
                }
                int gameId = GameAccessor.CreateGame(game, admin);
                //If an admin called this with the admin parameter, don't add it to their collection.
                if (username != null && admin == false)
                {
                    GameAccessor.CreateUserGame(gameId, username);
                }
            }
            catch (Exception)
            {
                throw;
            }

            return(result);
        }
        public static bool ToggleUserGame(int gameId, string username)
        {
            bool result = false;

            try
            {
                bool created = 1 == GameAccessor.CreateUserGame(gameId, username);
                if (created)
                {
                    result = created;
                }
                else
                {
                    result = 1 == GameAccessor.DeleteUserGame(gameId, username);
                }
            }
            catch (Exception)
            {
                throw;
            }

            return(result);
        }