Added option to check validity before persisting.