code: func (mc MongoClient) AddDevice(d contract.Device) (string, error) {
  	s := mc.session.Copy()
  	defer s.Close()
  
  	col := s.DB(mc.database.Name).C(db.Device)
  
  	// Check if the name exist (Device names must be unique)
  	count, err := col.Find(bson.M{"name": d.Name}).Count()
  	if err != nil {
  		return "", errorMap(err)
  	}
  	if count > 0 {
  		return "", db.ErrNotUnique
  	}
  
  	var mapped models.Device
  	id, err := mapped.FromContract(d, mc, mc, mc, mc)
  	if err != nil {
  		return "", errors.New("FromContract failed")
  	}
  
  	mapped.TimestampForAdd()
  
  	return id, errorMap(col.Insert(mapped))
  }
docs: /* ----------------------------- Device ---------------------------------- */