Move API logic from bookshelf github project