public function indexBy($list, $property, $meta=null, $allowDupes=null, $ignoreNulls=null)
    {
        $allowDupes  = $allowDupes  !== null ? $allowDupes  : false;
        $ignoreNulls = $ignoreNulls !== null ? $ignoreNulls : true;

        if (!$list) {
            return [];
        }

        if ($meta) {
            $meta = !$meta instanceof Meta ? $this->mapper->getMeta($meta) : $meta;
        }
        else {
            if (!($first = current($list))) {
                throw new \UnexpectedValueException();
            }
            $meta = $this->mapper->getMeta(get_class($first));
        }

        $index = array();

        $props = $meta ? $meta->getProperties() : [];
        foreach ($list as $object) {
            $propDef = !isset($props[$property]) ? null : $props[$property];
            $value = !$propDef || !isset($propDef['getter']) 
                ? $object->{$property} 
                : call_user_func(array($object, $propDef['getter']));

            if ($value === null && $ignoreNulls) {
                continue;
            }
            if (!$allowDupes && isset($index[$value])) {
                throw new \UnexpectedValueException("Duplicate value for property $property");
            }
            $index[$value] = $object;
        }
        return $index;
    }