anchor.diff:  moved_permanently(ReqData, {battle, MapId, Session} = Ctx) when is_list(MapId) ->
   	SessionUser = rpgb_session:get_user(Session),
   	UserId = proplists:get_value(id, SessionUser),
  -	BattleMap = boss_record:new(rpgb_battlemap, [{owner_id, UserId}]),
  -	{ok, BattleMap0} = BattleMap:save(),
  -	Id = BattleMap0:id(),
  +	BattleMap = #battlemap{owner_id = UserId},
  +	{ok, BattleMap0} = rpgb_data:save_battlemap(BattleMap),
  +	Id = BattleMap0#battlemap.id,
   	Url = rpgb:get_url(["battles",Id,"slug"]),
   	{{true, binary_to_list(Url)}, ReqData, {battle, BattleMap0, Session}};
   
  
positive.code: 	case wrq:path_info(battle_id, ReqData) of
  		undefined ->
  			{false, ReqData, Ctx};
  		MapId ->
  			case boss_db:find(MapId) of
  				{error, Reason} ->
  					?info("Error finding battlemap ~p:  ~p", [MapId, Reason]),
  					{false, ReqData, {battle, MapId, Session}};
  				undefined ->
  					?info("Didn't find the battlemap ~p", [MapId]),
  					MaxMaps = proplists:get_value(max_maps, SessionUser),
  					UserId = proplists:get_value(id, SessionUser),
  					MapList = boss_db:find(rpgb_battlemap, [{owner_id, UserId}]),
  					MapListCount = length(MapList),
  					?info("List count:  ~p; max maps:  ~p", [MapListCount, MaxMaps]),
  					if
  						MaxMaps < 0 ->
  							{false, ReqData, {battle, MapId, Session}};
  						0 ->
  							{true, ReqData, {battle, MapId, Session}};
  						MapListCount < MaxMaps ->
  							{false, ReqData, {battle, MapId, Session}};
  						true ->
  
negative.code: 			BattleMap2 = BattleMap1:set(url, iolist_to_binary(Uri)),
  			ReqData0 = wrq:set_resp_header("Location", binary_to_list(Uri), ReqData),
  			{true, ReqData0, {create_battle, Uri, Session}};
  		_ ->
  			?info("Creation failed, map named ~p already exists for user ~p", [Name, Userid]),
  			ReqData0 = wrq:set_resp_body(iolist_to_binary(mochijson2:encode(<<"map with given name already exists">>)), ReqData),
  			{{halt, 409}, ReqData0, Ctx}
  