Extract duplicated code in setter creation
Merge pull request #871 from realm/tg-setter-extract

Extract duplicated code in setter creation