public async Task <IActionResult> PostConfiguration([FromRoute] String IMEINumber,
                                                            [FromBody] UrlModel urlModel,
                                                            CancellationToken cancellationToken)
        {
            using (MobileConfiguration context = this.MobileConfigurationResolver())
            {
                ApplicationConfiguration config = await context.ApplicationConfiguration.SingleOrDefaultAsync(c => c.IMEINumber == IMEINumber, cancellationToken);

                if (config != null)
                {
                    throw new InvalidOperationException($"Configuration found for IMEI Number {IMEINumber}, use the PUT method to update the config");
                }

                ApplicationConfiguration newConfig = new ApplicationConfiguration
                {
                    IMEINumber         = IMEINumber,
                    SecurityServiceUri = urlModel.SecurityServiceUrl,
                    ManagementApiUri   = urlModel.ManagementApiUrl
                };
                await context.ApplicationConfiguration.AddAsync(newConfig, cancellationToken);

                await context.SaveChangesAsync(cancellationToken);

                return(this.NoContent());
            }
        }
        public async Task <IActionResult> PutConfiguration([FromRoute] String IMEINumber,
                                                           [FromBody] UrlModel urlModel,
                                                           CancellationToken cancellationToken)
        {
            using (MobileConfiguration context = this.MobileConfigurationResolver())
            {
                ApplicationConfiguration config = await context.ApplicationConfiguration.SingleOrDefaultAsync(c => c.IMEINumber == IMEINumber, cancellationToken);

                if (config == null)
                {
                    throw new NotFoundException($"No configuration found for IMEI Number {IMEINumber}");
                }

                config.ManagementApiUri   = urlModel.ManagementApiUrl;
                config.SecurityServiceUri = urlModel.SecurityServiceUrl;

                await context.SaveChangesAsync(cancellationToken);

                return(this.NoContent());
            }
        }