// UpdateLocationCommentCount updates location's comment count. func UpdateLocationCommentCount(location *model.Location) (int, error) { location.CommentCount = db.ORM.Model(location).Association("Comments").Count() if db.ORM.Save(location).Error != nil { return http.StatusInternalServerError, errors.New("Location comment's count is not updated.") } return http.StatusOK, nil }