Fixed a few errors with writing to the database and added a IsPhoto column.