added a function read post instances from databse