Persist file metadata in database