'Return a representation of the block.
NOTE: this method maintains backwards compatibility with the behavior
of Django Rest Framework v2.'

def to_representation(self, obj):

    data = super(BlockSerializer, self).to_representation(obj)
    if (obj.get('parent') is None):
        data['parent'] = None
    data['children'] = obj['children']
    return data
