public function build()
    {
        $filtered = array_diff(
            array_map('trim', $this->values),
            ['']
        );

        if (is_null($this->original)) {
            // If the original value is null, we'll assume
            // that the attribute doesn't exist yet.
            if (! empty($filtered)) {
                // If the filtered array is not empty, we can
                // assume we're looking to add values
                // to the current attribute.
                $this->setType(LDAP_MODIFY_BATCH_ADD);
            }

            // If the filtered array is empty and there is no original
            // value, then we can ignore this attribute since
            // we can't push null values to the server.
        } else {
            if (empty($filtered)) {
                // If there's an original value and the array is
                // empty then we can assume we are looking
                // to completely remove all values
                // of the current attribute.
                $this->setType(LDAP_MODIFY_BATCH_REMOVE_ALL);
            } else {
                // If the array isn't empty then we can assume
                // we're looking to replace all attributes.
                $this->setType(LDAP_MODIFY_BATCH_REPLACE);
            }
        }

        return $this;
    }