protected function buildBulkUpdate($data, $fields, $ids, $key)
	{

		//define the parts container array
		$parts = array();

		//define the template format string
		$template = "UPDATE %s SET %s WHERE %s IN (%s) ";

		//loop through the fields array composing the array
		foreach ($fields as $index => $field ) 
		{
			//initialize the subparts variable
			$subparts = $field . ' = (CASE ' . $key . ' ';

			//loop through the data array composing parts
			foreach ($data as $id => $info ) 
			{
	            //check if array is not empty 
	            if ( ! empty($info) ) 
	            {

					$subparts .=  ' WHEN '. $id . ' THEN ' . $this->quote($info[$field]) . ' ';

	            }

			}

			//finish the subpart
			$subparts .= ' END) ';

			//add this to the main parts array
			$parts[] = $subparts;

		}

		//convert parts array into string
		$parts = join(", ", $parts);

		//get the where clause
		$queryWhere = $ids;

		//check if where clause is empty
		if ( ! empty($queryWhere) ) 
		{
			//convert where clause array to string
			$where = join(", ", $queryWhere);

		}

		//return the formated query string
		return sprintf($template, $this->froms, $parts, $key, $where);

	}