public function registerRelation(SchemaBuilder $builder, RelationDefinition $definition)
    {
        if (!$this->config->hasRelation($definition->getType())) {
            throw new DefinitionException(sprintf(
                "Undefined relation type '%s' in '%s'.'%s'",
                $definition->getType(),
                $definition->sourceContext()->getClass(),
                $definition->getName()
            ));
        }

        if ($definition->isLateBinded()) {
            /**
             * Late binded relations locate their parent based on all existed records.
             */
            $definition = $this->locateOuter($builder, $definition);
        }

        $class = $this->config->relationClass(
            $definition->getType(),
            RelationsConfig::SCHEMA_CLASS
        );

        //Creating relation schema
        $relation = $this->factory->make($class, compact('definition'));

        $this->relations[] = $relation;
    }