func getOrCreateValue(store *storage.Storage, valueName string) (*entities.Value, error) { value, err := store.ValueByName(valueName) if err != nil { return nil, err } if value == nil { value, err = store.AddValue(valueName) if err != nil { return nil, err } } return value, nil }