added a service class

encapsulated the functionality for reading from and saving to the array