refactory for get_field_data() and set_field_data()