Refacotring prepareSet method