code: func (chat *Chat) SaveSetting(key string, value interface{}) error {
  
  	key = strings.ToLower(key)
  	serviceID := chat.ctx.getServiceID()
  	var cd chatData
  	_, err := chat.ctx.db.C("chats").FindId(chat.ID).Select(bson.M{"settings." + serviceID: 1}).
  		Apply(
  		mgo.Change{
  			Update: bson.M{
  				"$set":         bson.M{"settings." + serviceID + "." + key: value},
  				"$setOnInsert": bson.M{"createdat": time.Now()},
  			},
  			Upsert:    true,
  			ReturnNew: true,
  		},
  		&cd)
  
  	if err == nil && chat.data != nil && chat.data.Settings != nil && cd.Settings != nil && cd.Settings[serviceID] != nil {
  		chat.data.Settings[serviceID] = cd.Settings[serviceID]
  	}
  
  	return err
  }
docs: // SaveSetting sets Chat's setting for service with specific key