private void SaveEditedParkingLocation()
        {
            // save the edits
            var parkingLocation        = Window.ParkingLocationControl.GetCurrentObject() as ParkingLocation;
            var newParkingLocationName = DisplayItem.ParkingLocationName;
            var newParkingLocationGPS  = new GPSCoordinates(DisplayItem.ParkingLocationLatitude, DisplayItem.ParkingLocationLongitude);

            // write only to database if there was a change
            if ((parkingLocation.Name != newParkingLocationName) || (parkingLocation.Coordinates.Latitude != newParkingLocationGPS.Latitude) || (parkingLocation.Coordinates.Longitude != newParkingLocationGPS.Longitude))
            {
                if (DataAccessAdapter.EditParkingLocationName_GPS(parkingLocation.Id, newParkingLocationName, newParkingLocationGPS, out string errorMessage) == PersistenceManager.E_DBReturnCode.no_error)
                {
                    ShowMessage("Parking location data successfully changed.", E_MessageType.info);

                    // synchronize the display items of the main window and the lister window
                    ViewModelManager.SynchronizeDisplayItems(DisplayItem, _listerWindow.Controler.CurrentDisplayItem);
                }
                else
                {
                    ShowMessage("Error editing Parking location data." + errorMessage, E_MessageType.error);
                }
            }
            else
            {
                ShowMessage("No change done.", E_MessageType.info);
            }
        }
        private void SaveEditedShootingLocation()
        {
            // save the edits
            var shootingLocation        = Window.ShootingLocationControl.GetCurrentObject() as ShootingLocation;
            var newShootingLocationName = DisplayItem.ShootingLocationName;
            var newShootingLocationGPS  = new GPSCoordinates(DisplayItem.ShootingLocationLatitude, DisplayItem.ShootingLocationLongitude);

            var newPhoto1 = ImageTools.BitmapImageToByteArray(DisplayItem.Photo_1);
            var newPhoto2 = ImageTools.BitmapImageToByteArray(DisplayItem.Photo_2);
            var newPhoto3 = ImageTools.BitmapImageToByteArray(DisplayItem.Photo_3);

            var oldPhoto1 = shootingLocation.Photos?.ElementAtOrDefault(0)?.ImageBytes;
            var oldPhoto2 = shootingLocation.Photos?.ElementAtOrDefault(1)?.ImageBytes;
            var oldPhoto3 = shootingLocation.Photos?.ElementAtOrDefault(2)?.ImageBytes;

            // write only to database if there was a change
            if ((shootingLocation.Name != newShootingLocationName) ||
                (shootingLocation.Coordinates.Latitude != newShootingLocationGPS.Latitude) ||
                (shootingLocation.Coordinates.Longitude != newShootingLocationGPS.Longitude) ||
                (!ImageTools.SamePhoto(oldPhoto1, newPhoto1)) ||
                (!ImageTools.SamePhoto(oldPhoto2, newPhoto2)) ||
                (!ImageTools.SamePhoto(oldPhoto3, newPhoto3)))
            {
                var newPhotosAsByteArray = new List <byte[]>();
                if (newPhoto1 != null)
                {
                    newPhotosAsByteArray.Add(newPhoto1);
                }
                if (newPhoto2 != null)
                {
                    newPhotosAsByteArray.Add(newPhoto2);
                }
                if (newPhoto3 != null)
                {
                    newPhotosAsByteArray.Add(newPhoto3);
                }

                if (DataAccessAdapter.EditShootingLocation(shootingLocation.Id, newShootingLocationName, newShootingLocationGPS, newPhotosAsByteArray, out string errorMessage) == PersistenceManager.E_DBReturnCode.no_error)
                {
                    ShowMessage("Shooting location data successfully changed.", E_MessageType.info);

                    // synchronize the display items of the main window and the lister window
                    // do this for the current item (detail view) and the concerned item in the list view (AllDisplayItems)
                    ViewModelManager.SynchronizeDisplayItems(DisplayItem, _listerWindow.Controler.CurrentDisplayItem);
                    var selectedDisplayItem = _listerWindow.Controler.AllDisplayItems.FirstOrDefault(d => (d.Tag as ShootingLocation).Id == shootingLocation.Id);
                    ViewModelManager.SynchronizeDisplayItems(DisplayItem, selectedDisplayItem);
                }
                else
                {
                    ShowMessage("Error editing Shooting location data." + errorMessage, E_MessageType.error);
                }
            }
            else
            {
                ShowMessage("No change done.", E_MessageType.info);
            }
        }