Move folder logic to a separate class