Migrated methods from controller for better code integrity.