@Transactional
 @Override
 public Textbook update(Textbook object) {
   Textbook obj = textbookRepo.findOne(object.getId());
   if (obj != null) {
     updateChapters(object.getChapters(), obj);
     updateSubject(object.getSubject(), obj);
     updateName(object.getName(), obj);
     textbookRepo.saveAndFlush(obj);
   }
   return obj;
 }
 @Transactional
 @Override
 public Textbook delete(Long id) {
   Textbook obj = textbookRepo.findOne(id);
   if (obj != null) {
     Subject subject = obj.getSubject();
     if (subject != null) {
       subject.removeTextbook(obj);
       subjectRepo.saveAndFlush(subject);
     }
     textbookRepo.delete(obj);
     textbookRepo.flush();
   }
   return null;
 }
 @Transactional
 @Override
 public Textbook read(Long id) {
   return textbookRepo.findOne(id);
 }