created method to update and delete data from core data stack