factory for duplicate validation not working