Added support for insert and update