Don't use cast to PrimarydataStoreTO on the resource code
Fix compile