Refactoring - extracting validation of set elements.