refactor updae method for material