DB insert and extract functions

Added db insert and extract functions