Move data validity check into attribute class