you can get rid of this unchecked cast if you add an extra method around the Deserialization block bellow.