Implemented the insert method. added isNew function