replace call to api with interal database call