Attempting to make counting a relation to reduce DB queries