private function buildOwnerFilter(GetFilterEvent $event, $filter)
    {
        $class = $event->getTargetEntity()->getName();
        $interfaces = class_implements($class);

        if (\in_array(OwnerableInterface::class, $interfaces, true)) {
            $filter = $this->buildRequiredOwnerFilter($event, $filter);
        } elseif (\in_array(OwnerableOptionalInterface::class, $interfaces, true)) {
            $filter = $this->buildOptionalOwnerFilter($event, $filter);
        }

        return $filter;
    }