func search(db database.Interface) (err error) {
	var results []database.Game

	if results, err = db.GetAllGamesWithoutURL(); err != nil {
		return err
	}

	for _, game := range results {
		log.Printf("searching for %s", game.Name)
		searchResults, _ := wikipediasearch.Search(game.Name, true)

		if len(searchResults) > 0 {
			spew.Printf("found %v\n", searchResults)

			if err = db.UpsertIntField("steam_id", game.ID, bson.M{"wikipediaURL": searchResults[0].URL}); err != nil {
				return err
			}
		}
	}

	return nil
}
func (fetcher *Fetcher) UpdateOwnedGames(database database.Interface) error {
	var err error

	if err = fetcher.configure(database); err != nil {
		return err
	}

	if err = fetcher.getOwnedGames(); err != nil {
		return err
	}

	for _, ownedGame := range fetcher.OwnedGames.Response.Games {
		log.Printf("upserting %s games in the user's library", ownedGame.Name)
		if err = database.UpsertIntField("steam_id", ownedGame.ID, ownedGame); err != nil {
			return err
		}
	}
	return nil
}
func (fetcher *Fetcher) configure(database database.Interface) error {
	if fetcher.ConfigurationSettings == nil {
		fetcher.ConfigurationSettings = &mgoconfig.Configuration{
			Database: "steamfetcher",
			Key:      "steam",
			Session:  database.GetSession(),
		}
	}

	if err := fetcher.ConfigurationSettings.Get(&fetcher.configuration); err != nil {
		if err.Error() == "not found" {
			return errors.New("the steam configuration could not be fetched")
		}
		return err
	}

	fetcher.jsonFetcher = &jsonfetcher.Jsonfetcher{}

	return nil
}