created a method for saving data. Still need to implement it.