added db insert functionality