refactored getFromDbById