def write_attr(attr_name, value, to_call = nil)
      self[attr_name] = value && to_call ? value.__send__(to_call) : value
    end
def write_attr(attr_name, value, to_call = nil)
      self[attr_name] = value && to_call ? value.__send__(to_call) : value
    end
Helper method to write a value to an attribute

 @param [#to_sym] attr_name the name of the attribute
 @param [#to_s] value the value to set the attribute to