text: define(['knockout', 'gc/gc'], function (ko, gc) {
  
      return {
          getPictograms: function() {
              var self = this;
  
              var deferred = new $.Deferred();
              var promise = deferred.promise();
  
              promise.success = promise.done;
              promise.error = promise.fail;
              promise.complete = promise.done;
  
              gc.rest.get({
                  url : '/api/v1/pictograms/',
                  success : function(data, status, xhr) {
                      if (self._onload) {
                          self._onload(data, status, xhr);
                      }
                      
                      deferred.resolve(data, status, xhr);
                  },
                  error : function(jqXHR, status, error) {
                      if (self._onerror) {
                          self._onerror(jqXHR, status, error);
                      }
  
                      deferred.reject(jqXHR, status, error);
                  },
                  complete : function(data, status, xhr) {
                      if (self._oncomplete) {
                          self._oncomplete(data, status, xhr);
                      }
  
                      deferred.resolve(data, status, xhr);
                  }
              });
  
              return promise;
          },
          getPictogram: function(pictogramId) {
              var self = this;
  
              var deferred = new $.Deferred();
              var promise = deferred.promise();
  
              promise.success = promise.done;
              promise.error = promise.fail;
              promise.complete = promise.done;
  
              gc.rest.get({
                  url : '/api/v1/pictograms/' + pictogramId,
                  success : function(data, status, xhr) {
                      if (self._onload) {
                          self._onload(data, status, xhr);
                      }
  
                      deferred.resolve(data, status, xhr);
                  },
                  error : function(jqXHR, status, error) {
                      if (self._onerror) {
                          self._onerror(jqXHR, status, error);
                      }
  
                      deferred.reject(jqXHR, status, error);
                  },
                  complete : function(data, status, xhr) {
                      if (self._oncomplete) {
                          self._oncomplete(data, status, xhr);
                      }
  
                      deferred.resolve(data, status, xhr);
                  }
              });
  
              return promise;
          },
          updatePictogram: function(pictogramId, pictogramUpdateData) {
              var self = this;
  
              var deferred = new $.Deferred();
              var promise = deferred.promise();
  
              promise.success = promise.done;
              promise.error = promise.fail;
              promise.complete = promise.done;
  
              gc.rest.put({
                  url : '/api/v1/pictograms/' + pictogramId,
                  data: pictogramUpdateData.data(),
                  success : function(data, status, xhr) {
                      if (self._onload) {
                          self._onload(data, status, xhr);
                      }
  
                      deferred.resolve(data, status, xhr);
                  },
                  error : function(jqXHR, status, error) {
                      if (self._onerror) {
                          self._onerror(jqXHR, status, error);
                      }
  
                      deferred.reject(jqXHR, status, error);
                  },
                  complete : function(data, status, xhr) {
                      if (self._oncomplete) {
                          self._oncomplete(data, status, xhr);
                      }
  
                      deferred.resolve(data, status, xhr);
                  }
              });
  
              return promise;
          },
          generateTemplate: function(pictogramId, templateUpdateData) {
              var self = this;
  
              var deferred = new $.Deferred();
              var promise = deferred.promise();
  
              promise.success = promise.done;
              promise.error = promise.fail;
              promise.complete = promise.done;
  
              gc.rest.put({
                  url : '/api/v1/pictograms/' + pictogramId + '/generate',
                  data: templateUpdateData.data(),
                  success : function(data, status, xhr) {
                      if (self._onload) {
                          self._onload(data, status, xhr);
                      }
  
                      deferred.resolve(data, status, xhr);
                  },
                  error : function(jqXHR, status, error) {
                      if (self._onerror) {
                          self._onerror(jqXHR, status, error);
                      }
  
                      deferred.reject(jqXHR, status, error);
                  },
                  complete : function(data, status, xhr) {
                      if (self._oncomplete) {
                          self._oncomplete(data, status, xhr);
                      }
  
                      deferred.resolve(data, status, xhr);
                  }
              });
  
              return promise;
          },
          removePictogram: function(id, pictogramId) {
              var self = this;
  
              var deferred = new $.Deferred();
              var promise = deferred.promise();
  
              promise.success = promise.done;
              promise.error = promise.fail;
              promise.complete = promise.done;
  
              gc.rest.del({
                  url : '/api/v1/media-assets/' + pictogramId + '/assets/' + id,
                  success : function(data, status, xhr) {
                      if (self._onload) {
                          self._onload(data, status, xhr);
                      }
  
                      deferred.resolve(data, status, xhr);
                  },
                  error : function(jqXHR, status, error) {
                      if (self._onerror) {
                          self._onerror(jqXHR, status, error);
                      }
  
                      deferred.reject(jqXHR, status, error);
                  },
                  complete : function(data, status, xhr) {
                      if (self._oncomplete) {
                          self._oncomplete(data, status, xhr);
                      }
  
                      deferred.resolve(data, status, xhr);
                  }
              });
  
              return promise;
          },
  
          // ----------------------------------------------------------------
          // Returns an options object that can be used by the gc-pager.
          // ----------------------------------------------------------------
          pagingOptions: function(options) {
  
              options = options || {};
  
              return {
                  // Base URI of product-API.
                  url: '/api/v1/pictograms',
                  searchUrl: '/api/v1/search/pictograms',
                  filter: options.filter || [],
                  // Only load specific fields for better performance.
                  fields: options.fields || [ 'id', 'label', 'pictogramId', 'pictogram', 'url', 'webThumbnailPath', 'mimeType', 'name', 'size' ],
                  // Optionally pre-sort the results.
                  sort: options.sort || ['createdOn'],
                  columns: options.columns,
                  // Returns an array that the pager can add to the
                  // ko.observableArray.
                  getArray: function(data) {
                      return data.pictograms || [];
                  }
              }
          }
      }
  });