insert to database functional