protected function updateByType($data, $entity)
	{
		// Note: this switch exists like this because PHP does not have "traditional method overloading".
		switch(gettype($entity))
		{
			// UUID string
			case 'string':
				$entityPayload = $this->getOneByUuid($entity);

				if($entityPayload->getStatus() != 'found')
				{
					return $entityPayload;
				}

				// Update the Entity itself.
				return $this->updateByEntity($data, $entityPayload->getData()->first());
			break;

			// Use an Object to update.
			case 'object':
				switch($entity->getType(true))
				{
					// Use an EntityIdentifier to update.
					case IdentifierServiceProvider::getProviderKey():

						// Update the Entity itself.
						return $this->updateByIdentifier($entity, $data);
					break;

					// Use an Entity to update.
					default:
						// Make sure this service is configured to use the given entity's aggregate.
						if(array_key_exists($entity->getType(true), $this->getAggregate()))
						{
							// Update the Entity itself.
							return $this->updateByEntity($data, $entity);
						}
						else
						{
							return new Payload(null, $entity->getType() . '_' . 'not_configured');
						}
				}
			break;

			// Use a compound key to update.
			case 'array':
				$entityPayload = $this->getOneByCompoundKey($entity);

				if($entityPayload->getStatus() != 'found')
				{
					return $entityPayload;
				}

				// Update the Entity itself.
				return $this->updateByEntity($data, $entityPayload->getData());
			break;

			default:
				return new Payload(null, 'invalid_entity');
		}
	}