public function save( $fields = null ) 
	{
		$settings = static::_model();

		// check if we should save just some fields
		if ( is_null( $fields ) ) 
		{
			$fields = array_keys( $settings['defaults'] );
		}
		elseif ( !is_array( $fields ) ) 
		{
			$fields = array( $fields );
		}

		$pkey = $this->_data_store[$settings['primary_key']];
		$data = array();

		// Now we have to filter the data to the save g
		foreach( $fields as $field )
		{
			$data[$field] = $this->_data_store[$field];
		}

		// We have to remove the primary key from our data
		if ( array_key_exists( $settings['primary_key'], $data ) )
		{
			unset( $data[$settings['primary_key']] );
		}

		// We pass the data trough the before save callback.
		// This is a local callback for performence reasons.
		$data = $this->_before_save( $data );

		// after the before save event,
		// do we have to to something with the data type?
		foreach( $data as $key => $value )
		{
			if ( array_key_exists( $key, $settings['types'] ) )
			{
				$data[$key] = $this->_type_assignment_set( $settings['types'][$key], $value );
			}
		}

		// check if we have to set the timestamps automatically
		if ( $settings['timestamps'] === true )
		{
			if ( array_key_exists( 'created_at', $data ) )
			{
				// check if created_at should be set
				if ( $data['created_at'] < 1 )
				{
					$this->_data_store['created_at'] = $data['created_at'] = time();
				}
			}

			if ( array_key_exists( 'modified_at', $data ) )
			{
				$this->_data_store['modified_at'] =$data['modified_at'] = time();
			}
		}

		// When we already have a primary key we are going to 
		// update our record instead of inserting a new one.
		if ( !is_null( $pkey ) && $pkey > 0 ) 
		{
			$query = DB::update( $settings['table'], $data )
				->where( $settings['primary_key'], $pkey );
		}
		// No primary key? Smells like an insert query. 
		else 
		{
			$query = DB::insert( $settings['table'], $data );
		}

		// We check the query type to handle the response right
		if ( $query instanceof Query_Insert ) 
		{
			$this->_data_store[$settings['primary_key']] = $query->run();
		}
		else 
		{
			$query->run();
		}

		// after save hookt
		$this->_after_save();

		// return self
		return $this;
	}