@RequestMapping(value = "/article/settags/{id}", method = RequestMethod.POST)
 public int setTags(@RequestBody String tags, @PathVariable Long id) throws IOException {
   Article article = articleRepository.findOneById(id);
   Set<Tag> tagSet =
       new HashSet<>(Arrays.asList((new ObjectMapper()).readValue(tags, Tag[].class)));
   for (Tag tag : tagSet) {
     Tag tempTag;
     if ((tempTag = simpleTagRepository.findOneByName(tag.getName())) != null)
       tag.copyFrom(tempTag);
     else simpleTagRepository.save(tag);
     tag.addArticle(article);
   }
   article.updateTags(tagSet);
   accountService.update(article);
   checkForEmptyTags();
   return 0;
 }
 @RequestMapping(value = "/tag/check")
 public int checkForEmptyTags() {
   for (Tag tag : simpleTagRepository.findAll())
     if (tag.isEmpty()) simpleTagRepository.delete(tag);
   return 0;
 }
 @RequestMapping(value = "/article/gettags/all", method = RequestMethod.GET)
 public Object[] getAllTags() {
   return simpleTagRepository.findAll().toArray();
 }