Project project = Project.findByOwnerAndProjectName(ownerName, projectName);
DynamicForm labelForm = form().bindFromRequest();
String categoryName = labelForm.get("categoryName");
IssueLabelCategory category = new IssueLabelCategory();
category.project = project;
category.name = categoryName;
if (category.exists()) {
category = IssueLabelCategory.findBy(category);
} else {
category.isExclusive = Boolean.parseBoolean(labelForm.get("categoryIsExclusive"));
category.save();
}
IssueLabel label = new IssueLabel();
label.project = project;
label.name = labelForm.get("labelName");