def to_hash(retain_references=false)
      if retain_references
        canton        = @canton
        communities   = @communities
      else
        canton        = @canton && @canton.license_tag
        communities   = @communities.map(&:community_number)
      end

      {
        :name             => @name,
        :district_number  => @district_number,
        :canton           => canton,
        :communities      => communities,
      }
    end
def to_hash(retain_references=false)
      if retain_references
        canton        = @canton
        communities   = @communities
      else
        canton        = @canton && @canton.license_tag
        communities   = @communities.map(&:community_number)
      end

      {
        :name             => @name,
        :district_number  => @district_number,
        :canton           => canton,
        :communities      => communities,
      }
    end
@param [String] district_number
   The two letter abbreviation of the districts name as used on license plates.
 @param [String] name
   The official name of the district.
 @param [SwissMatch::Canton] canton
   The canton this district belongs to
 @param [SwissMatch::Communities] communities
   The communities belonging to this district
 @param [Boolean] retain_references
   If set to false, :agglomeration will be set to the community_number and
   :canton to the canton's license_tag.

 @return [Hash]
   All properties of the district as a hash.