public async Task <Model> PutAsync(Model model)
        {
            Model oldProject = await GetAsyncOnlyProject(model.Id);

            Model oldProjectConverted = await GetAsync(model.Id);

            string labelPath = oldProject.LabeledPath;

            if (oldProjectConverted.LabeledPath != model.LabeledPath)
            {
                labelPath = await Base64Controller.CocoUploadAsync(new Data(model.Id, model.Name, "", model.LabeledPath));
            }
            List <Data> removes1 = new List <Data>();
            List <Data> removes2 = new List <Data>();

            foreach (Data data in model.Images)
            {
                bool done = false;

                if (oldProjectConverted.Images != null)
                {
                    foreach (var image in oldProjectConverted.Images)
                    {
                        if (image.Base64 == data.Base64 && image.Id == data.Id)
                        {
                            removes1.Add(data);
                            removes2.Add(image);
                            done = true;
                        }
                    }
                }
                if (!done)
                {
                    await Base64Controller.ImageUploadAsync(data);
                }
            }

            foreach (var data in removes1)
            {
                model.Images.Remove(data);
            }

            foreach (var data in removes2)
            {
                oldProjectConverted.Images?.Remove(data);
            }

            if (oldProjectConverted.Images != null)
            {
                foreach (var data in oldProjectConverted.Images)
                {
                    await Base64Controller.RemoveImageAsync(data);
                }
            }

            Model newModel = new Project()
            {
                CreationDate       = model.CreationDate,
                Description        = model.Description,
                FinishedAnnotation = model.FinishedAnnotation,
                LabeledPath        = labelPath,
                Name      = model.Name,
                Timestamp = model.Timestamp,
                Id        = model.Id
            };
            Model respondModel = await UpdateModelAsync(newModel);

            string dir_path = $"./Ressources/Labels/{newModel.Id}_{newModel.Name}";

            if (System.IO.File.Exists(dir_path))
            {
                respondModel.LabeledPath = System.IO.File.ReadAllText(dir_path);
            }
            return(respondModel);
        }
 public Task UploadSingleCoco(Data data)
 {
     return(Base64Controller.CocoUploadAsync(data));
 }