// Create creates a new group func (*GroupsController) Create(ctx *gin.Context) { var groupJSON groupJSON ctx.Bind(&groupJSON) var groupIn models.Group groupIn.Name = groupJSON.Name groupIn.Description = groupJSON.Description err := groupIn.Insert() if err != nil { log.Errorf("Error while InsertGroup %s", err) ctx.AbortWithError(http.StatusInternalServerError, err) return } ctx.JSON(http.StatusCreated, groupIn) }