add fetchEntitiesFromDB function