adding abality to switch between insert & update