func (db Database) EnsureGuild(guildid string) (guild Guild, err error) {
	inDatabase, err := db.IsGuildInDatabase(guildid)
	if err != nil {
		return
	}
	if !inDatabase {
		guild = Guild{
			GuildID: guildid,
			Balance: 0,
		}
		err = db.CreateGuild(guild)
		if err != nil {
			return
		}
	}
	return guild, nil
}
EnsureGuild checks if the guild exists in the database, if not it
will create the guild in the database.
package storage
import (
	mgo "github.com/globalsign/mgo"
	"github.com/globalsign/mgo/bson"
)
type Guild struct {
	GuildID string `bson:"guildid"`
	Balance int    `bson:"balance"`
}
func (db Database) ensureGuildsCollection() (collection *mgo.Collection, err error) {
	collection = db.session.DB(db.config.Name).C("guilds")
	err = db.session.DB(db.config.Name).C("guilds").EnsureIndex(mgo.Index{
		Key:    []string{"guildid"},
		Unique: true,
	})
	return
}