Publish Image to Umbraco Media Library

public class MediaClass
{

    public
HttpPostedFileBase file { get; set; }
    public
string FileNameAlias { get; set; }
    public
string NameOfImage { get; set; }
    public
string ParentMediaName { get; set; }
}

protected
int AddImageToUmbraco(MediaClass mediaClass)
{

    var
ms = Services.MediaService;
    var
newFile = ms.CreateMedia(mediaClass.NameOfImage,      uQuery.GetMediaByName(mediaClass.ParentMediaName).FirstOrDefault().Id, "Image", member.Id);
   newFile.SetValue(
"umbracoFile", mediaClass.file);
    ms.Save(newFile);

    return
newFile.Id;
    //return the id of newly created image

}