protected function defineClass($fields)
    {
        //Rule to define class instance
        $definition = $this->schema[DocumentEntity::SH_INSTANTIATION];

        if (is_string($definition)) {
            //Document has no variations
            return $definition;
        }

        if (!is_array($fields)) {
            //Unable to resolve for non array set, using same class as given
            return $this->class;
        }

        $defined = $this->class;
        foreach ($definition as $field => $child) {
            if (array_key_exists($field, $fields)) {
                //Apparently this is child
                $defined = $child;
                break;
            }
        }

        return $defined;
    }