public function build()
    {

        $this->profiler->log('Build started');
        $this->callbacks['log']( "normality entity builder start" );

        $this->prepare();

        $processing = $this->options->getMatchingRelations( $skipping );

        $this->callbacks['log']( "skipping {$skipping->count()} ". $skipping->implode(', ', 'name' ) );
        $this->callbacks['log']( "processing {$processing->count()}" );

        // build relation
        $this->profiler->log('generation begin');
        $built = [];
        foreach( $processing as $relation ) {
            $entity = $this->buildRelation( $relation );
            $this->profiler->log($entity);
            $built[] = $entity;
        }
        $this->profiler->log('generation end');

        $this->buildEntityRegistration( $built );

        // remove orphan entities
        $options = $this->options->prepareOptions;
        if( $options & Options::REMOVE_ORPHANS ) {

            if( !( $options & Options::BACKUP ) ) {
                throw new IncompatibleOptionException("You cannot have Options::REMOVE_ORPHANS set if Options::BACKUP is not set");
            }

            $dirs = [
                $this->options->getPath('entity'),
                $this->options->getPath('entityPlaceholder'),
                $this->options->getPath('repository'),
                $this->options->getPath('repositoryPlaceholder'),
            ];

            $files = [];

            foreach( $dirs as $dir ) {

                $i = new \DirectoryIterator($dir);

                foreach( $i as $file ) {
                    if( !$file->isDot() and !$file->isDir() ) {
                        $files[$file->getPathname()] = substr( $file->getBasename(), 0, -4 );
                    }
                }

            }

            // identify files we no longer need
            $orphans = array_diff( $files, $built );

            foreach( $orphans as $orphan => $entityName ) {
                unlink( $orphan );
            }

        }

        return $processing;

    }