implements insert method