//Create and store user in database
//string is provided by device, username by server
func (ch *SportHandler) CreateSport(token string, sport *services.Sport) (*services.Sport, error) {
	userid, _ := ch.userR.GetUserIdFromToken(token)

	if userid != "" {
		if sport.Icon != nil && sport.Icon.Content != nil {
			//image was transmitted with sport.
			//create new image
			image, _ := ch.imageR.SaveImage(sport.Icon)
			sport.Icon = nil
			sport.Iconid = image.ID
			ch.repo.CreateSport(sport)
		}
	}

	return sport, nil

}
func (rep *SportRepository) CreateSport(sport *services.Sport) *services.Sport {
	u, _ := uuid.NewV4()
	sportId := u.String()
	sport.ID = &sportId

	rep.mongo.Collection.Insert(sport)
	return sport

}