@classmethod
def serialize(cls, obj, skip_primary_key=False, skip_foreign_keys=False,
    relations_level=1, relations_ignore=None, relations_include=None):
    """
        Converts the object to a serializable dictionary.
        :param obj: the object to serialize

        :param skip_primary_key: should primary keys be skipped
        :type skip_primary_key: bool

        :param skip_foreign_keys: should foreign keys be skipped
        :type skip_foreign_keys: bool

        :param relations_level: how many levels of relations to serialize
        :type relations_level: int

        :param relations_ignore: relationship names to ignore
        :type relations_ignore: list

        :param relations_include: relationship names to include
        :type relations_include: list

        :return: a serializable dictionary
        :rtype: dict
        """
    data = {}
    data = cls.serialize_columns(obj, data, skip_primary_key, skip_foreign_keys
        )
    if relations_level > 0:
        if relations_ignore is None:
            relations_ignore = []
        data = cls.serialize_relations(obj, data, relations_level,
            relations_ignore, relations_include)
    return data
