private User getUserFromLoginName(String login) {
   UserDto user = userDao.selectActiveUserByLogin(login);
   if (user == null) {
     logger.warn("Cannot find an active user with login name [{}]", login);
     return null;
   }
   return user.toUser();
 }
  private Result<QProfileActivity> searchActivities(
      QProfileActivityQuery query, SearchOptions options) {
    DbSession session = dbClient.openSession(false);
    try {
      SearchResponse response = activityIndex.doSearch(query, options);
      Result<QProfileActivity> result = new Result<>(response);
      for (SearchHit hit : response.getHits().getHits()) {
        QProfileActivity profileActivity = new QProfileActivity(hit.getSource());
        RuleDto ruleDto = dbClient.ruleDao().getNullableByKey(session, profileActivity.ruleKey());
        profileActivity.ruleName(ruleDto != null ? ruleDto.getName() : null);

        String login = profileActivity.getLogin();
        if (login != null) {
          UserDto user = dbClient.userDao().selectActiveUserByLogin(session, login);
          profileActivity.authorName(user != null ? user.getName() : null);
        }
        result.getHits().add(profileActivity);
      }
      return result;
    } finally {
      session.close();
    }
  }