code: function moveArray(object, sourceKey, destinationKey, useSameObject) {
      var embeddedObject = object[sourceKey];
      if (embeddedObject) {
          var processedData = {};
          processedData[destinationKey] = {};
  
          if (useSameObject === true) {
              // loop over all items in the embedded object and add them to the processed data
              angular.forEach(Object.keys(embeddedObject), function (key) {
                  processedData[destinationKey][key] = embeddedObject[key];
              });
          } else {
              // remove the key and replace it with the value of it
              var key = Object.keys(embeddedObject)[0];
              processedData[destinationKey] = embeddedObject[key];
          }
  
          object = angular.extend(object, processedData);
          delete object[sourceKey];
      }
      return object;
  }
docs: Moves a key with an array value to the destination key. It is also possible to specify to use the value of the
  first key of the object[sourceKey] object instead of the same object.
  
  @param {object} object the object in which the source key exists and destination key is created
  @param {string} sourceKey the source key from which the array is moved
  @param {string} destinationKey the destination key to which the array is moved
  @param {boolean} useSameObject true if the same object is used for the destinationKey, false if the value of the
  first key is used
  @returns {object} the processed object