move insert to server side