function enlargeNeoDatabase($unifiedName)
{
    $client = new Everyman\Neo4j\Client('localhost', 7474);
    $client->getTransport()->setAuth('neo4j', 'muresearch');
    //Check if the author exists
    $exist = FALSE;
    $authorExists = "match (u:Person {name: \"" . $unifiedName . "\"}) return u";
    $query = new Query($client, $authorExists);
    $result = $query->getResultSet();
    foreach ($result as $r) {
        $exist = TRUE;
    }
    if (!$exist) {
        //Author does not exists. Must be of Mizzou
        $crawler = new CoauthorNetworkCrawler($unifiedName, $affiliation = "University of Missouri");
        $crawler->insertDB('localhost', 7474, 'neo4j', 'muresearch');
        $setHasSearched = "match (u:Person {name: \"" . $unifiedName . "\"}) set u.hasSearched = 1";
        $query = new Query($client, $setHasSearched);
        $result = $query->getResultSet();
        return;
    }
    //Check if we need to crawl the network for this author while the author already exists.
    $hasSearched = "match (u:Person {name: \"" . $unifiedName . "\"}) return has(u.hasSearched) as hasSearched";
    $query = new Query($client, $hasSearched);
    $result = $query->getResultSet();
    foreach ($result as $r) {
        if ($r['hasSearched']) {
            //The user has been searched before. No need to re-search it
            return;
        } else {
            //The user has NOT been seasrched before.
            //Get the affiliation of this user
            $getAffiliation = "match (u:Person {name: \"" . $unifiedName . "\"}) return u.affiliation as affiliation";
            $query = new Query($client, $getAffiliation);
            $result = $query->getResultSet();
            foreach ($result as $r) {
                if (!empty($r['affiliation'])) {
                    //Affiliation info presented
                    $affiliation = filterAffiliation($r['affiliation']);
                } else {
                    //Affiliation info empty
                    $affiliation = "";
                }
            }
            $setHasSearched = "match (u:Person {name: \"" . $unifiedName . "\"}) set u.hasSearched = 1";
            $query = new Query($client, $setHasSearched);
            $result = $query->getResultSet();
            //echo $affiliation."\n";
            $crawler = new CoauthorNetworkCrawler($unifiedName, $affiliation);
            //print_r($crawler->crawlPubmed());
            $crawler->insertDB('localhost', 7474, 'neo4j', 'muresearch');
            return;
        }
    }
}
        return false;
    }
}
function checkDataFormat1stLevel($var)
{
    if (is_array($var)) {
        $key = array_keys($var);
        $val = array_values($var);
        $count = count($var);
        for ($i = 0; $i < $count; $i++) {
            if (!is_int($key[$i]) || !checkDataFormat2ndLevel($val)) {
                return false;
            }
        }
        return true;
    } else {
        return false;
    }
}
if (isset($_POST['data'])) {
    $var = json_decode($_POST['data']) or die("posted data not in json format");
    //if (checkDataFormat1stLevel($var)) {
    $c = new CoauthorNetworkCrawler(null, null);
    $c->insertDB($host, $port, $username, $auth, $var);
    //}
    //else{
    //    print("something wrong in the format of the posted data");
    //}
} else {
    print "This file should be posted";
}