Refactored code from CMS controller to domain model