Fix factory trait. Add book repository function.