@Override
    public int deleteById(final String userId) {
        final User user = loadById(userId);
        if (user == null) {
            return 0;
        }
        DBObject query = new BasicDBObject();
        query.put("_id", new ObjectId(userId));
        final int deleteCount = destroy(query, UserImpl.COLLECTION_NAME);
        accesstokenService.deleteAllForUser(user.getName()); //TODO: probably should go through listener subscribing to delete event
        serverEventBus.post(UserDeletedEvent.create(userId, user.getName()));
        return deleteCount;
    }
@Test
    @MongoDBFixtures("UserServiceImplTest.json")
    public void testDeleteById() throws Exception {
        assertThat(userService.deleteById("54e3deadbeefdeadbeef0001")).isEqualTo(1);
        assertThat(userService.deleteById("54e3deadbeefdeadbeef0003")).isEqualTo(1);
        assertThat(userService.deleteById("00000eadbeefdeadbee00000")).isEqualTo(0);
    }