private void SaveMaterial() { this.Item.EndEdit(); if (this.operation == Utils.Operation.Add) { ((MaterialsDTO)Item).MaterialId = materialsService.MaterialCreate((MaterialsDTO)Item); } else { materialsService.MaterialUpdate((MaterialsDTO)Item); } }