   jsonfile.writeFileSync './picksel.json', config, options
 
     
+# Returns true if a request to the Pixabay API was successful.
+#
+# @param [Object] error any error returned with the response
+# @param [Object] body the body of the response
+#
+isSuccessful = (error, body) -> 
+  !error \
+  && body \
+  && body.hits \
+  && body.hits instanceof Array \
+  && body.hits.length > 0
+  
+    
 # Downloads an image.
 #
 # @param [String] id the Pixabay image ID

  # Build URL for API request.
  url = buildUrl(user.apiKey, id, resolution)
  
  log.info 'Requesting information for image with ID ' \
    + id \
    + ' from ' \
    + url
    
  # Call out to Pixabay.
  options =
    url: url
    json: true
  request options, (error, response, body) ->
    if error || !body || !body.hits
      log.error 'Couldn\'t get information about image with ID \'' \
        + id \
        + '\''
    else
      url = body.hits[0][resolutions[resolution]]
      log.info 'Downloading file from ' \
        + url
      tempDestination = destination + '.pickseltemp'
      file = fs.createWriteStream tempDestination
      req = https.get url, (response) ->

              log.info 'Finished installing image with ID \'' \
                + id \
                + '\''
    else
      # Download failed.
      log.error 'Couldn\'t get information about image with ID \'' \
        + id \
        + '\''
        
      
# Installs a single image.
#
