public function update($doiValue, $url=NULL, $xml=NULL)
    {

        if (!$this->isClientAuthenticated()) {
            $this->setResponse("responsecode", "MT009");
            return false;
        }

        $doi = $this->doiRepo->getByID($doiValue);
        $this->setResponse('doi', $doiValue);

        if ($doi === null) {
            $this->setResponse('responsecode', 'MT011');
            return true;
        }

        // check if this client owns this doi
        if (!$this->isDoiAuthenticatedClients($doiValue, $doi->client_id)) {
            $this->setResponse('responsecode', 'MT008');
            $this->setResponse('verbosemessage',$doiValue." is not owned by ".$this->getAuthenticatedClient()->client_name);
            return false;
        }

        // Validate URL and URL Domain
        if (isset($url) && $url!="") {
            $this->setResponse('url', $url);
            $validDomain = URLValidator::validDomains(
                $url, $this->getAuthenticatedClient()->domains
            );
            if (!$validDomain) {
                $this->setResponse("responsecode", "MT014");
                return false;
            }
        }

        if(isset($xml) && $xml!="") {
            // need to check that doi provided in xml matches doi
            $xml = XMLValidator::replaceDOIValue($doiValue, $xml);

            // Validate xml
            if ($this->validateXML($xml) === false) {
                $this->setResponse('responsecode', 'MT007');
                return false;
            }
        }

        if (isset($url) && $url!="") {
            $result = $this->dataciteClient->updateURL($doiValue, $url);
            if ($result === true) {
                $this->setResponse('responsecode', 'MT002');
                //update the database DOIRepository
                $this->doiRepo->doiUpdate($doi, array('url'=>$url));
            } else {
                $this->setResponse('responsecode', 'MT010');
                $this->setResponse('verbosemessage', array_first($this->dataciteClient->getErrors()));
                return false;
            }
        }


        if(isset($xml) && $xml!="") {
            $result = $this->dataciteClient->update($xml);
            if ($result === true) {
                $this->setResponse('responsecode', 'MT002');
                //update the database DOIRepository
                $this->doiRepo->doiUpdate($doi, array('datacite_xml'=>$xml,'status'=>'ACTIVE'));
            } else {
                $this->setResponse('responsecode', 'MT010');
                $this->setResponse('verbosemessage', array_first($this->dataciteClient->getErrors()));
                return false;
            }
        }
        return true;

    }