public async Task <dynamic> LearnImage(FileUploadRequest response, string id) { watch.Reset(); watch.Start(); if (!response.File.Name.EndsWith(".jpg")) { var r = (Response)"The file doesn't have not .jpg extension"; r.StatusCode = HttpStatusCode.BadRequest; return(r); } var imageBytes = await response.File.Value.ToByteArray(); var user = _usersService.GetById(id); var usersToLearn = new Dictionary <User, IEnumerable <byte[]> >(); usersToLearn.Add(user, new List <byte[]> { imageBytes }); await _faceService.LearnMore(usersToLearn); watch.Stop(); return($"Learned {id} with {imageBytes.Length} bytes in {watch.ElapsedMilliseconds} ms"); }