private function index($entity)
    {
        //Get meta info
        $meta = $this->getMeta($entity);

        //Get class name
        $class = $meta->getName();

        //Get the index from the repository
        $index = $this->getRepository($class)->getIndex();

        //Get the loaded node if it's a node
        if($meta instanceof NodeMeta)
        {
            $en = $this->getEverymanNode($entity);
        }

        //Otherwise, get the loaded relation
        else
        {
            $en = $this->getEverymanRelation($entity);
        }

        //Add all indexed properties
        foreach ($meta->getIndexedProperties() as $property)
        {
            $index->add($en, $property->getName(), $property->getValue($entity));
        }

        //Get the primary key
        $pk = $meta->getPrimaryKey();
        $name = $pk->getName();
        $id = $pk->getValue($entity);

        //Add the primary key to the index
        $index->add($en, $name, $id);
    }