public async Task <IActionResult> CreateOrUpdateDeviceType(DeviceTypeToCreateOrUpdate deviceTypeDto)
        {
            if (deviceTypeDto == null)
            {
                return(BadRequest());
            }

            if (deviceTypeDto.Id == null)
            {
                //ovaj blok se izvrsava ukoliko je u pitanju kreiranje tipa uredjaja
                var deviceType = _mapper.Map <DeviceType>(deviceTypeDto);
                _repo.CreateDeviceType(deviceType);

                if (await _repo.SaveAll())
                {
                    var deviceTypeFromRepo = await _repo.GetDeviceType(deviceType.Id);

                    var deviceTypeToReturn = _mapper.Map <DeviceTypeToReturnSingleDto>(deviceTypeFromRepo);

                    return(CreatedAtRoute("GetDeviceType", new { id = deviceTypeFromRepo.Id }, deviceTypeToReturn));
                }

                throw new Exception("Creating device type failed on save");
            }
            else
            {
                //ovaj blok se izvrsava ukoliko je u pitanju update tipa uredjaja
                var deviceTypeToUpdate = _mapper.Map <DeviceType>(deviceTypeDto);

                _repo.UpdateDeviceType(deviceTypeToUpdate);

                if (await _repo.SaveAll())
                {
                    return(NoContent());
                }

                throw new Exception("Updating device type failed on save");
            }
        }