public function hasAssociatedIdentity( $userId, $identity )
    {
        $sql    = $this->sql( $this->getTableInSchema( 'user_identity' ) );
        $select = $sql->select()
                      ->columns( array( 'id' ) )
                      ->where( array(
                          'userId'      => (int) $userId,
                          'identity'    => (string) $identity,
                      ) )
                      ->limit( 1 );

        $result = $sql->prepareStatementForSqlObject( $select )
                      ->execute();

        if ( $result->getAffectedRows() < 1 )
        {
            return null;
        }

        foreach ( $result as $row )
        {
            if ( ! empty( $row['id'] ) )
            {
                return $row['id'];
            }
        }

        return null;
    }