Implementing a basic select and insert api