PHP implementation of requesting data from API and inserting into database using transactions.