Replaces object call by database query