reusable function for callbacks after db-calls