Updated the way gems are inserted into db during an update