function GeotabDataStore(webDataStore, dataStoreService) {
    this.dataStoreService = dataStoreService;
    this.webDataStore = webDataStore;

    this.getDeviceCount = function(callback) {
        /// <summary>
        /// Get the number of devices.
        /// </summary>
        this.dataStoreService.GetDeviceCount(this.webDataStore, callback);
    };

    this.getDataSize = function(callback) {
        /// <summary>
        /// Get the number of devices.
        /// </summary>
        this.dataStoreService.GetDataSize(this.webDataStore, callback);
    };

    this.getDevices = function(callback) {
        /// <summary>
        /// Get all the devices.
        /// </summary>
        this.dataStoreService.GetDevices(this.webDataStore, callback);
    };

    this.getOrganizationNode = function() {
        /// <summary>
        /// Returns the organization node.
        /// </summary>
        return { entityIdentifier: { id: "9998"} };
    };

    /// <summary>
    /// Returns the populated nodes in the next available 'layer' of the hiararchy below this node.
    /// </summary>
    this.getSubTrees = function(callback, node) {
        var populateParentRecurse = function(value) {
            var length = value.length;
            if (length > 0) {
                for (i = 0; i < length; i++) {
                    var parent = value[i];
                    var children = parent.Children;
                    for (j = 0; j < children.length; j++) {
                        children[j].Parent = parent;
                    }
                    populateParentRecurse(children);
                }
            }
        };
        var populateParents = function(value) {
            populateParentRecurse(value);
            callback(value);
        };
        this.dataStoreService.GetSubTrees(this.webDataStore, node, populateParents);
    };

    this.addNode = function(callback, node) {
        /// <summary>
        /// Add a new node.
        /// </summary>
        this.dataStoreService.AddNode(this.webDataStore, node, callback);
    };

    this.removeNode = function(callback, node) {
        /// <summary>
        /// Remove this node.
        /// </summary>
        this.dataStoreService.RemoveNode(this.webDataStore, node, callback);
    };

    this.setNode = function(callback, node) {
        /// <summary>
        /// Set a particular node to new values.
        /// </summary>
        this.dataStoreService.SetNode(this.webDataStore, node, callback);
    };

    this.getDataStoreUser = function(callback) {
        /// <summary>
        /// Returns the populated user for the dataStore being used.
        /// </summary>
        this.dataStoreService.GetDataStoreUser(this.webDataStore, callback);
    };

    this.getDriversSearch = function(callback, nodes, includeSubtree, searchFilter) {
        this.dataStoreService.GetDriversSearch(this.webDataStore, nodes, includeSubtree, searchFilter, callback);
    };

    this.getDevicesSearch = function(callback, nodes, includeSubtree, searchFilter) {
        this.dataStoreService.GetDevicesSearch(this.webDataStore, nodes, includeSubtree, searchFilter, callback);
    };

    this.getZones = function(callback, nodes, includeSubtree, searchFilter, rectangleF) {
        this.dataStoreService.GetZones(this.webDataStore, nodes, includeSubtree, searchFilter, rectangleF, callback);
    };

    this.getLogs = function(callback, device, fromUtcDate, toUtcDate) {
        this.dataStoreService.GetLogs(this.webDataStore, device, fromUtcDate, toUtcDate, callback);
    };

    this.getRoutes = function(callback, nodes, includeSubtree, searchFilter) {
        this.dataStoreService.GetRoutes(webDataStore, nodes, includeSubtree, searchFilter, callback);
    };

    /// <summary>
    /// Gets the trips activity details for a specified date time range, collection of nodes (AKA groups) and devices.
    /// </summary>
    this.getActivityDetailByDevice = function(callback, reportFromUtc, reportToUtc, nodes, devices, includeAuxiliary) {
        this.dataStoreService.GetActivityDetailByDevice(this.webDataStore, reportFromUtc, reportToUtc, nodes, devices, includeAuxiliary, callback);
    };

    /// <summary>
    /// Gets the trips activity details for a specified date time range, collection of nodes (AKA groups) and drivers.
    /// </summary>
    this.getActivityDetailByDriver = function(callback, reportFromUtc, reportToUtc, nodes, drivers, includeAuxiliary) {
        this.dataStoreService.GetActivityDetailByDriver(this.webDataStore, reportFromUtc, reportToUtc, nodes, drivers, includeAuxiliary, callback);
    };

    /// <summary>
    /// Gets the trips activity summary for a specified date time range, collection of nodes (AKA groups) and drivers.
    /// </summary>
    this.getActivitySummaryByDevice = function(callback, reportFromUtc, reportToUtc, nodes, devices, minCustomerStopSeconds, expandNodesIntoAssets) {
        this.dataStoreService.GetActivitySummaryByDevice(this.webDataStore, reportFromUtc, reportToUtc, nodes, devices, minCustomerStopSeconds, expandNodesIntoAssets, callback);
    };

    /// <summary>
    /// Gets the trips activity summary for a specified date time range, collection of nodes (AKA groups) and drivers.
    /// </summary>
    this.getActivitySummaryByDriver = function(callback, reportFromUtc, reportToUtc, nodes, drivers, minCustomerStopSeconds, expandNodesIntoAssets) {
        this.dataStoreService.GetActivitySummaryByDriver(this.webDataStore, reportFromUtc, reportToUtc, nodes, drivers, minCustomerStopSeconds, expandNodesIntoAssets, callback);
    };

    this.addTextMessage = function(callback, textMessage) {
        this.dataStoreService.AddTextMessage(this.webDataStore, textMessage, callback);
    }
    this.addTextMessageWithReply = function(callback, textMessage, responseMessage) {
    this.dataStoreService.AddTextMessageWithReply(this.webDataStore, textMessage, responseMessage, callback);
    }
    this.getTextMessages = function(callback) {
        this.dataStoreService.GetTextMessages(this.webDataStore, callback);
    }
    this.removeTextMessage = function(callback, textMessage) {
        this.dataStoreService.RemoveTextMesage(this.webDataStore, textMessage, callback);
    }
}
