public void DeletePoI ()
	{
		var p = new PoIInfo ();
		p.Id = poiID;
		if (poiInterface.Delete (p))
			poiID = string.Empty;
	}
		/// <summary>
		/// Updates a PoI
		/// </summary>
		/// <param name="p">PoIInfo to update</param>
		/// <returns>true on success</returns>
		public bool Update (PoIInfo p)
		{
			string request = new UpdatePoIRequest(_poiUrl);
			
			string json = MiniJSON.Json.Serialize(p.ToDictionary(true));

			string result = httpRequest.PostRequest(json, request);
			//Console.WriteLine(result);

			return !string.IsNullOrEmpty(result) && result.Equals("POI data updated succesfully!");
		}
		public void TestDeleteNotExists ()
		{
			PoIInfo pInfo = new PoIInfo ("00000000-acd2-4cdf-a65e-cded7bc7833e");
			PoIInterface pInterface = new PoIInterface (POI_DP_URL);

			try {
				pInterface.Delete (pInfo);
			} catch (System.Net.WebException ex) {
				Assert.AreEqual ("The specified UUID was not found from the database!", ex.Message);
			}

		}
	public string AddPoI ()
	{
		PoIInfo poi = new PoIInfo ();
		poi.FwCore = new FwCore ();
		poi.FwCore.Location = new Location (1, 1);
		poi.FwCore.Category = "test";
		poi.FwCore.Name = "test poi";
		var ret = poiInterface.Add (poi);
		Debug.Log (ret.FwCore);
		
		return ret.Id;
	}
		/// <summary>
		/// Deserializes the PoI list.
		/// </summary>
		/// <returns>The PoI list.</returns>
		/// <param name="json">Json string</param>
		public static PoIInfoList DeserializePoIList (string json)
		{
			var poiResults = MiniJSON.Json.Deserialize (json) as Dictionary<string, object>;
			var pois = poiResults ["pois"] as Dictionary<string, object>;
			var retList = new PoIInfoList ();

			if (pois != null && pois.Count > 0) {
				foreach (var poi in pois) {
					PoIInfo pInfo = new PoIInfo (poi);
					retList.Add (pInfo);
				}
			}

			return retList;
		}
		/// <summary>
		/// Adds a PoI
		/// </summary>        
		/// <param name="p">PoIInfo to add</param>
		/// <returns>the PoI completed with the created UUID</returns>
		public PoIInfo Add (PoIInfo p)
		{            
			string request = new AddPoIRequest(_poiUrl);

			string json = PoISerializationHelper.SerializePOI(p);

			string result = httpRequest.PostRequest(json, request);
			//Console.WriteLine(result);

			if (string.IsNullOrEmpty(result))
				return null;

			var createdResult = new PoiCreatedResult(MiniJSON.Json.Deserialize(result));
			if (createdResult.Success)
				p.Id = createdResult.Id;

			return p;
		}
		public void TestPoIInfo ()
		{

			var fwCore = new FwCore ();
			fwCore.Location = new Location (52.365299224853516, 9.6899404525756836);
			fwCore.Category = "restaurant";
//			var source = new Source ();
//			source.Name = "OpenStreetMap";
//			source.WebSite = @"http://www.openstreetmap.org";
//			source.Licence = @"http://www.openstreetmap.org/copyright";
//			fwCore.Source = source;
			fwCore.Name = "Mi Pueblito";
			fwCore.Description = "no steps, to wheelchair toilets";
			fwCore.LastUpdate = new LastUpdate ("x", 1234);
			PoIInfo pInfo = new PoIInfo ("asdb-asdf-asdf-asdf");
			pInfo.FwCore = fwCore;

			string jsonLocationString = @"""location"":{""wgs84"":{""latitude"":52.365299224853516,""longitude"":9.6899404525756836}}";
			string jsonLastUpdateString = @"""last_update"":{""timestamp"":1234,""responsible"":""x""}";
			string jsonNameString = @"""name"":{"""":""Mi Pueblito""}";
			string jsonDescrString = @"""description"":{"""":""no steps, to wheelchair toilets""}";
			string jsonCatString = @"""category"":""restaurant""";
			//string jsonSourceString = @"""source"":{""name"":""OpenStreetMap"",""website"":""http://www.openstreetmap.org"",""license"":""http://www.openstreetmap.org/copyright""}";
			string jsonFwCore = string.Format ("{0},{1},{2},{3},{4}", jsonLocationString, jsonNameString, jsonCatString, jsonDescrString, jsonLastUpdateString);
			string jsonPoi = @"{""asdb-asdf-asdf-asdf"":{""fw_core"":{" + jsonFwCore + "}}}";
			//string jsonPoiUpdate = @"{""asdb-asdf-asdf-asdf"":{""fw_core"":{" + jsonFwCore + @"},""fw_time"":{""type"":""open""}}}";

			var poiObject = MiniJSON.Json.Deserialize (jsonPoi) as System.Collections.Generic.Dictionary<string, object>;
			foreach (var k in poiObject) {
				var poiDeserialized = new PoIInfo (k);
				Assert.AreEqual (poiDeserialized, pInfo);
			}


			var poiSerialized = pInfo.ToDictionary (true);
			var poiJsonSerialized = MiniJSON.Json.Serialize (poiSerialized);
			Assert.AreEqual (jsonPoi, poiJsonSerialized);
		}
		public void TestAddDelete ()
		{
			PoIInterface pInterface = new PoIInterface (POI_DP_URL);
			PoIInfo pInfo = new PoIInfo ();
			FwCore fwCore = new FwCore ();
			fwCore.Name = "asd";
			fwCore.Category = "restaurant";
			fwCore.Location = new Location (0.345, 0.66577);
			fwCore.Source = new Source ("OpenStreetMap", @"http://www.openstreetmap.org", @"http://www.openstreetmap.org/copyright");

			pInfo.FwCore = fwCore;
			pInfo.FwTime = FwTime.Open;

			pInfo = pInterface.Add (pInfo);
			Console.WriteLine (pInfo.Id);

			Assert.IsNotNullOrEmpty (pInfo.Id);

			bool retDelete = pInterface.Delete (pInfo);

			Assert.IsTrue (retDelete);

		}
		/// <summary>
		/// Gets the distance in Kilometers between two PoI
		/// </summary>
		/// <param name="p1">PoI 1</param>
		/// <param name="p2">PoI 2</param>
		public static double Distance(PoIInfo p1, PoIInfo p2)
		{
			return Location.Distance (p1.FwCore.Location, p2.FwCore.Location);
		}
		/// <summary>
		/// Serializes the PoI.
		/// </summary>
		/// <returns>The POI in json string</returns>
		/// <param name="pInfo">the PoI</param>
		public static string SerializePOI (PoIInfo pInfo)
		{
			var poiDic = pInfo.ToDictionary ();
			string json = MiniJSON.Json.Serialize (poiDic);
			return json;
		}
		/// <summary>
		/// Removes a PoI
		/// </summary>        
		/// <param name="p">PoIInfo to remove</param>
		/// <returns>true on success</returns>
		public bool Delete (PoIInfo p)
		{
			string request = new DeletePoIRequest(_poiUrl, p.Id);

			string result = httpRequest.DeleteRequest(request);
			//Console.WriteLine(result);

			return !string.IsNullOrEmpty(result) && result.Equals("POI deleted succesfully");
		}