Write the cap data to db

Capture cap data
Write data to db.