Fix bug with lazy='dynamic'

Attempts to fix issue, in which dynamically loaded SQLAlchemy relationship cause an exception because they are not properly converted to dictionaries.
Example:
```python
class OfferPicture(db.Model):
    __tablename__ = 'offer_pictures'

    offer_id = db.Column(db.Integer, db.ForeignKey('offers.id'), nullable=False)
    url = db.Column(db.UnicodeText)

class Offer(db.Model):
    __tablename__ = 'offers'

    name = db.Column(db.Unicode(), nullable=False)
    pictures = db.relationship('OfferPicture', primaryjoin="OfferPicture.offer_id==Offer.id", backref=db.backref('offer'), lazy='dynamic')
```