get pgtId moved into separate method
use repository API instead temporary directory
use repository instead temporary directory