api returns object inserted after insert into database