For the purposes of this Act, the employment of a person, or the employment of a person as an apprentice, under a law of the Commonwealth or of a State but otherwise than under a contract of service or contract of apprenticeship shall be treated as if that employment were employment under a contract of service or employment under a contract of apprenticeship, as the case may be.