public function attach(DescriptorInterface $objectDescriptor, $instance)
    {

        // load the session ID from the environment
        $sessionId = Environment::singleton()->getAttribute(EnvironmentKeys::SESSION_ID);

        // query if we've stateful session bean
        if ($objectDescriptor instanceof StatefulSessionBeanDescriptorInterface) {
            // check if we've a session-ID available
            if ($sessionId == null) {
                throw new \Exception('Can\'t find a session-ID to attach stateful session bean');
            }

            // load the lifetime from the session bean settings
            $lifetime = $this->getManagerSettings()->getLifetime();

            // we've to check for pre-attach callbacks
            foreach ($objectDescriptor->getPreAttachCallbacks() as $preAttachCallback) {
                $instance->$preAttachCallback();
            }

            // create a unique SFSB identifier
            $identifier = SessionBeanUtil::createIdentifier($sessionId, $objectDescriptor->getName());

            // load the map with the SFSBs
            $sessionBeans = $this->getStatefulSessionBeans();

            // add the stateful session bean to the map
            $sessionBeans->add($identifier, $instance, $lifetime);

            // stop processing here
            return;
        }

        // query if we've stateless session or message bean
        if ($objectDescriptor instanceof StatelessSessionBeanDescriptorInterface ||
            $objectDescriptor instanceof MessageDrivenBeanDescriptorInterface) {
            // simply destroy the instance
            $this->destroyBeanInstance($instance);

            // stop processing here
            return;
        }

        // query if we've singleton session bean
        if ($objectDescriptor instanceof SingletonSessionBeanDescriptorInterface) {
            // we've to check for pre-attach callbacks
            foreach ($objectDescriptor->getPreAttachCallbacks() as $preAttachCallback) {
                $instance->$preAttachCallback();
            }

            // stop processing here
            return;
        }

        // we've an unknown bean type => throw an exception
        throw new InvalidBeanTypeException('Tried to attach invalid bean type');
    }