* @throws Exception
*/
public void setCategory(ServiceContext context, String mdId, String categId) throws Exception {
final MetadataCategoryRepository categoryRepository = _applicationContext.getBean(MetadataCategoryRepository.class);
final MetadataCategory newCategory = categoryRepository.findOne(Integer.valueOf(categId));
final boolean[] changed = new boolean[1];
_metadataRepository.update(Integer.valueOf(mdId), new Updater<Metadata>() {
@Override
public void apply(@Nonnull Metadata entity) {
changed[0] = !entity.getCategories().contains(newCategory);