protected function resolveIdentity($username, $accountId)
    {
        $identitySeed = $this->getServiceBroker()
            ->service('User')
            ->resolveIdentity($username);
        
        $accountIds = isset($identitySeed['accountIds']) ? $identitySeed['accountIds'] : [];
    
        if (in_array($accountId, $accountIds)) {
            $identitySeed['account']    = $accountId;
            $identitySeed['accountId']  = $accountId;
        }
        
        if ($identitySeed) {
            return $this->prepareIdentity($identitySeed);
        } else {
            return false;
        }
    }