'Return a dictionary with model\'s attributes.'

def to_dict(self):

    d = dict()
    for attr in self.__class__.attributes:
        d[attr] = getattr(self, attr)
    d['remote_ids'] = []
    for remote in self.remote_ids:
        d['remote_ids'].append(remote.remote_id)
    return d
