add insert/update functionality to main activity