Moved from MySql to PostgreSql. Added try-catch.