Moving logic into custom process instance repository