@Transactional @Override @CacheEvict(value = "usersByUsername", allEntries = true) public CommandProcessingResult deleteUser(final Long userId) { final AppUser user = this.appUserRepository.findOne(userId); if (user == null || user.isDeleted()) { throw new UserNotFoundException(userId); } user.delete(); this.appUserRepository.save(user); return new CommandProcessingResultBuilder() .withEntityId(userId) .withOfficeId(user.getOffice().getId()) .build(); }