added method to write BLOB to database