Move the business logic to get sanitized strings in key or value into the corresponding classes.