remove duplicated code (found by sonar)