protected function setFilter($filter, AssetInterface $asset)
    {
        if (is_null($filter)) {
            return;
        }

        if (!empty($filter['filter'])) {
            $this->ensureByFilter($asset, $filter['filter']);

            return;
        }

        if (!empty($filter['service'])) {
            $this->ensureByService($asset, $filter['service']);

            return;
        }

        throw new Exception\RuntimeException(
            'Invalid filter supplied. Expected Filter or Service.'
        );
    }