private async Task <int?> StoreImage(ClientEditorForm editor)
        {
            var settings = new ResizeSettings
            {
                Width           = 300,
                Height          = 300,
                CropTopLeft     = new PointF(editor.ImageX, editor.ImageY),
                CropBottomRight = new PointF(editor.ImageX + editor.ImageWidth, editor.ImageY + editor.ImageHeight)
            };

            using (var ms = new MemoryStream())
            {
                ImageBuilder.Current.Build(editor.Image, ms, settings);

                var file = new File
                {
                    FileName    = Path.GetFileName(editor.Image.FileName),
                    FileType    = FileType.Image,
                    ContentType = editor.Image.ContentType,
                    Content     = ms.ToByteArray()
                };

                context.Files.Add(file);
                await context.SaveChangesAsync();

                return(file.Id);
            }
        }
 public AddOrEditClientCommand(ClientEditorForm editor, ModelStateDictionary modelState)
 {
     this.ModelState = modelState;
     this.Editor     = editor;
 }