On a general duality result for moment problems