Added ability to delete images and reference objects from db, added error handling for adding  reference objects