func (a *DataStreamGroupService) Update(dataStreamGroups *models.DataStreamGroup) error {
	revel.INFO.Println("updating data stream group", dataStreamGroups.ToString())
	count, err := persistence.Dbm.Update(dataStreamGroups)
	checkErr(err, "data stream group not updated "+dataStreamGroups.ToString())
	if count == 1 {
		return nil
	}
	return err
}
func (a *DataStreamGroupController) Add() revel.Result {
	var dataStreamGroup models.DataStreamGroup
	err := json.NewDecoder(a.Request.Body).Decode(&dataStreamGroup)
	if err != nil {
		a.Response.Status = http.StatusNotAcceptable
		return a.RenderJson(err)
	}
	dataStreamGroup.Validate(a.Validation)
	if a.Validation.HasErrors() {
		a.Response.Status = http.StatusNotAcceptable
		return a.RenderJson(a.Validation.Errors)
	}
	return a.RenderJson(a.DataStreamGroupService.Save(&dataStreamGroup))
}
func (a *DataStreamGroupController) Update(id int64) revel.Result {
	var dataStreamGroup models.DataStreamGroup
	err := json.NewDecoder(a.Request.Body).Decode(&dataStreamGroup)
	if err != nil {
		a.Response.Status = http.StatusNotAcceptable
		return a.RenderJson(err)
	}
	revel.INFO.Println(&dataStreamGroup)
	if dataStreamGroup.Id != id {
		a.Response.Status = http.StatusNotAcceptable
		return a.RenderJson(&models.Error{Error: "Entity ID and URL ID don't match"})
	}
	dataStreamGroup.Validate(a.Validation)
	if a.Validation.HasErrors() {
		a.Response.Status = http.StatusNotAcceptable
		return a.RenderJson(a.Validation.Errors)
	}
	err = a.DataStreamGroupService.Update(&dataStreamGroup)
	if err != nil {
		a.Response.Status = http.StatusConflict
		return a.RenderJson(err)
	}
	return a.RenderJson(&dataStreamGroup)
}
func (a *DataStreamGroupService) Save(dataStreamGroup *models.DataStreamGroup) *models.DataStreamGroup {
	revel.INFO.Println("saving data stream group", dataStreamGroup.ToString())
	persistence.Dbm.Insert(dataStreamGroup)
	return dataStreamGroup
}