Category AssetLink Id is always 0

 

I create an asset for a specific category (CMS -> Commerce -> Catalog -> select a category -> select All Properties -> Assets -> Add Media), indicate the name of the group. Then Publish changes.

But when I try to get assets for a category, I see that AssetLink ID is 0. My code:

public string GetNodeAssetUrl(NodeContent node, string groupName, bool relative)
{
    string url = string.Empty;
    if (node?.CommerceMediaCollection == null || !node.CommerceMediaCollection.Any())
    {
        return null;
    }

    var foundAsset = node.CommerceMediaCollection.FirstOrDefault(
        item => item.GroupName.ToLower().Contains(groupName.ToLower()));
    if (foundAsset == null)
    {
        return null;
    }

    if (!_contentLoader.Service.TryGet(foundAsset.AssetLink, out IContent content))
    {
        return null;
    }
...

I always see that the content is null and foundAsset.AssetLink.ID == 0. Can someone tell me why is that so? I'm using version 12 of Epi.

#202117 Edited, Mar 14, 2019 14:55