select inserted, name, return_values from
    (select inserted, cast('Comment' as text) as name, jsonb_build_object('store', comment.store, 'meta_id', comment.meta_id, 'author', author, 'content', content) as return_values from (select store, meta_id, inserted, author, content from comment) comment join (select store, meta_id, owner from nft where owner = $1) nft on comment.store = nft.store and comment.meta_id = nft.meta_id and comment.author != $1
union
    select inserted, name, return_values from event where name in ('BuySingleNft', 'TokenBuySingleNft') and return_values->>'from' = $1) notifications
union
    select inserted, cast('Resale' as text) as name, return_values from event where name in ('BuySingleNft') and address in (select address from store where creator = $1) and return_values->>'from' != $1
union
    select inserted, cast('TokenResale' as text) as name, return_values from event where name in ('TokenBuySingleNft') and address in (select address from store where creator = $1) and return_values->>'from' != $1
order by inserted desc limit $2 offset $3;
